diff --git a/src/queue/processors/http/deliver.ts b/src/queue/processors/http/deliver.ts index cb92a4d760..82dcf06ad4 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(),