mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 15:53:09 +02:00
Fix bug
This commit is contained in:
parent
dd7bf9b2a3
commit
9d50a06d9c
1 changed files with 4 additions and 2 deletions
|
@ -6,11 +6,13 @@ import { registerOrFetchInstanceDoc } from '../../../services/register-or-fetch-
|
||||||
import Instance from '../../../models/instance';
|
import Instance from '../../../models/instance';
|
||||||
|
|
||||||
export default async (job: bq.Job, done: any): Promise<void> => {
|
export default async (job: bq.Job, done: any): Promise<void> => {
|
||||||
|
const { host } = new URL(job.data.to);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await request(job.data.user, job.data.to, job.data.content);
|
await request(job.data.user, job.data.to, job.data.content);
|
||||||
|
|
||||||
// Update stats
|
// Update stats
|
||||||
registerOrFetchInstanceDoc(job.data.user.host).then(i => {
|
registerOrFetchInstanceDoc(host).then(i => {
|
||||||
Instance.update({ _id: i._id }, {
|
Instance.update({ _id: i._id }, {
|
||||||
$set: {
|
$set: {
|
||||||
latestRequestSentAt: new Date(),
|
latestRequestSentAt: new Date(),
|
||||||
|
@ -22,7 +24,7 @@ export default async (job: bq.Job, done: any): Promise<void> => {
|
||||||
done();
|
done();
|
||||||
} catch (res) {
|
} catch (res) {
|
||||||
// Update stats
|
// Update stats
|
||||||
registerOrFetchInstanceDoc(job.data.user.host).then(i => {
|
registerOrFetchInstanceDoc(host).then(i => {
|
||||||
Instance.update({ _id: i._id }, {
|
Instance.update({ _id: i._id }, {
|
||||||
$set: {
|
$set: {
|
||||||
latestRequestSentAt: new Date(),
|
latestRequestSentAt: new Date(),
|
||||||
|
|
Loading…
Reference in a new issue