core: use mongodb@6

This commit is contained in:
undefined committed 2025-03-21 06:28:56 +08:00
1 parent 0bd15caee6
commit b6f1a9c627
17 files changed
+64 -80

No files matched your search

+5 -5
View File
@@ -19,9 +19,9 @@ async function getFirst(query: Filter<Task>) {
try {
const q = { ...query };
const res = await coll.findOneAndDelete(q, { sort: { priority: -1 } });
if (res.value) {
logger.debug('%o', res.value);
return res.value;
if (res) {
logger.debug('%o', res);
return res;
}
return null;
} catch (e) {
@@ -182,9 +182,9 @@ export async function apply(ctx: Context) {
logger.error(e);
continue;
}
if (argv.options.showEvent) logger.info('Event: %o', res.value);
if (argv.options.showEvent) logger.info('Event: %o', res);
// eslint-disable-next-line no-await-in-loop
await (res.value ? handleEvent(res.value) : sleep(500));
await (res ? handleEvent(res) : sleep(500));
}
});
await db.ensureIndexes(collEvent, { name: 'expire', key: { expire: 1 }, expireAfterSeconds: 0 });