use TimeService everywhere in the backend

This commit is contained in:
Hazelnoot 2025-10-01 19:11:33 -04:00
parent ed750fd990
commit 6cceca90f9
123 changed files with 550 additions and 285 deletions

View file

@ -11,6 +11,7 @@ import type { Config } from '@/config.js';
import type Logger from '@/logger.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { StatusError } from '@/misc/status-error.js';
import { TimeService } from '@/core/TimeService.js';
import { bindThis } from '@/decorators.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import { UserWebhookDeliverJobData } from '../types.js';
@ -28,6 +29,7 @@ export class UserWebhookDeliverProcessorService {
private httpRequestService: HttpRequestService,
private queueLoggerService: QueueLoggerService,
private readonly timeService: TimeService,
) {
this.logger = this.queueLoggerService.logger.createSubLogger('webhook');
}
@ -58,14 +60,14 @@ export class UserWebhookDeliverProcessorService {
});
this.webhooksRepository.update({ id: job.data.webhookId }, {
latestSentAt: new Date(),
latestSentAt: this.timeService.date,
latestStatus: res.status,
});
return 'Success';
} catch (res) {
this.webhooksRepository.update({ id: job.data.webhookId }, {
latestSentAt: new Date(),
latestSentAt: this.timeService.date,
latestStatus: res instanceof StatusError ? res.statusCode : 1,
});