backend: fixup missing deadTime and incorrect import

This commit is contained in:
Chloe Kudryavtsev 2022-10-16 09:32:01 -04:00
parent 21c1e5c06c
commit d762143b89

View file

@ -13,7 +13,7 @@ import { Instance } from '@/models/entities/instance.js';
import { StatusError } from '@/misc/fetch.js'; import { StatusError } from '@/misc/fetch.js';
import { DeliverJobData } from '@/queue/types.js'; import { DeliverJobData } from '@/queue/types.js';
import { LessThan } from 'typeorm'; import { LessThan } from 'typeorm';
import { DAY } from '@/const.ts'; import { DAY } from '@/const.js';
const logger = new Logger('deliver'); const logger = new Logger('deliver');
@ -31,6 +31,7 @@ export default async (job: Bull.Job<DeliverJobData>) => {
return 'skip (blocked)'; return 'skip (blocked)';
} }
const deadTime = new Date(Date.now() - deadThreshold);
const isSuspendedOrDead = await Instances.countBy([ const isSuspendedOrDead = await Instances.countBy([
{ host: puny, isSuspended: true }, { host: puny, isSuspended: true },
{ host: puny, lastCommunicatedAt: LessThan(deadTime) }, { host: puny, lastCommunicatedAt: LessThan(deadTime) },