mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-13 22:28:58 +09:00
Fix bug
This commit is contained in:
parent
60604b6f51
commit
76cff98220
@ -14,7 +14,7 @@ import Instance from '../../models/instance';
|
|||||||
|
|
||||||
export const logger = apLogger.createSubLogger('deliver');
|
export const logger = apLogger.createSubLogger('deliver');
|
||||||
|
|
||||||
export default (user: ILocalUser, url: string, object: any) => new Promise(async (resolve, reject) => {
|
export default async (user: ILocalUser, url: string, object: any) => {
|
||||||
logger.info(`--> ${url}`);
|
logger.info(`--> ${url}`);
|
||||||
|
|
||||||
const timeout = 10 * 1000;
|
const timeout = 10 * 1000;
|
||||||
@ -32,9 +32,10 @@ export default (user: ILocalUser, url: string, object: any) => new Promise(async
|
|||||||
sha256.update(data);
|
sha256.update(data);
|
||||||
const hash = sha256.digest('base64');
|
const hash = sha256.digest('base64');
|
||||||
|
|
||||||
const addr = await resolveAddr(hostname).catch(e => reject(e));
|
const addr = await resolveAddr(hostname);
|
||||||
if (!addr) return;
|
if (!addr) return;
|
||||||
|
|
||||||
|
const _ = new Promise((resolve, reject) => {
|
||||||
const req = request({
|
const req = request({
|
||||||
protocol,
|
protocol,
|
||||||
hostname: addr,
|
hostname: addr,
|
||||||
@ -79,6 +80,9 @@ export default (user: ILocalUser, url: string, object: any) => new Promise(async
|
|||||||
});
|
});
|
||||||
|
|
||||||
req.end(data);
|
req.end(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
await _;
|
||||||
|
|
||||||
//#region Log
|
//#region Log
|
||||||
publishApLogStream({
|
publishApLogStream({
|
||||||
@ -88,7 +92,7 @@ export default (user: ILocalUser, url: string, object: any) => new Promise(async
|
|||||||
actor: user.username
|
actor: user.username
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
});
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve host (with cached, asynchrony)
|
* Resolve host (with cached, asynchrony)
|
||||||
|
Loading…
Reference in New Issue
Block a user