mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: use mongodb@6
This commit is contained in:
17 files changed
+64
-80
No files matched your search
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user