remove queued user updated when deleted

This commit is contained in:
Hazelnoot 2025-06-25 14:10:12 -04:00
parent f06bbad94b
commit 473b3993c4

View file

@ -132,6 +132,8 @@ export class CollapsedQueueService implements OnApplicationShutdown {
concurrency: 4, // High concurrency - this queue gets a lot of activity
},
);
this.internalEventService.on('userChangeDeletedState', this.onUserDeleted);
}
@bindThis
@ -166,18 +168,20 @@ export class CollapsedQueueService implements OnApplicationShutdown {
this.logger.error(`Error persisting ${queue.name}: ${renderInlineError(error)}`);
}
@bindThis
private onUserDeleted(data: { id: string, isDeleted: boolean }) {
if (data.isDeleted) {
this.updateUserQueue.delete(data.id);
}
}
async onApplicationShutdown() {
// TODO note/user delete events
this.internalEventService.off('userChangeDeletedState', this.onUserDeleted);
await this.performAllNow();
}
}
function maxDate(first: Date, second: Date | undefined): Date;
function maxDate(first: Date | undefined, second: Date): Date;
function maxDate(first: Date | undefined, second: Date | undefined): Date | undefined;
// eslint requires a space here -_-
function maxDate(first: Date | undefined, second: Date | undefined): Date | undefined {
if (first && second) {
if (first.getTime() > second.getTime()) {