From 9d50a06d9c478e0e416c78dd0c321fd1e74277f9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 7 Feb 2019 23:37:39 +0900 Subject: [PATCH] Fix bug --- src/queue/processors/http/deliver.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/queue/processors/http/deliver.ts b/src/queue/processors/http/deliver.ts index cb92a4d76..82dcf06ad 100644 --- a/src/queue/processors/http/deliver.ts +++ b/src/queue/processors/http/deliver.ts @@ -6,11 +6,13 @@ import { registerOrFetchInstanceDoc } from '../../../services/register-or-fetch- import Instance from '../../../models/instance'; export default async (job: bq.Job, done: any): Promise => { + const { host } = new URL(job.data.to); + try { await request(job.data.user, job.data.to, job.data.content); // Update stats - registerOrFetchInstanceDoc(job.data.user.host).then(i => { + registerOrFetchInstanceDoc(host).then(i => { Instance.update({ _id: i._id }, { $set: { latestRequestSentAt: new Date(), @@ -22,7 +24,7 @@ export default async (job: bq.Job, done: any): Promise => { done(); } catch (res) { // Update stats - registerOrFetchInstanceDoc(job.data.user.host).then(i => { + registerOrFetchInstanceDoc(host).then(i => { Instance.update({ _id: i._id }, { $set: { latestRequestSentAt: new Date(),