ui: pageLoader: support moduleName

This commit is contained in:
undefined committed 2022-03-15 13:59:16 +08:00
1 parent 0569a98739
commit ab3cad57b8
6 files changed
+56 -33

No files matched your search

+4 -2
View File
@@ -8,16 +8,18 @@ export async function inc(op: string, ident: string, periodSecs: number, maxOper
const now = new Date().getTime();
const expireAt = new Date(now - (now % (periodSecs * 1000)) + periodSecs * 1000);
try {
await coll.findOneAndUpdate({
const res = await coll.findOneAndUpdate({
op,
ident,
expireAt,
opcount: { $lt: maxOperations },
}, { $inc: { opcount: 1 } }, { upsert: true });
}, { $inc: { opcount: 1 } }, { upsert: true, returnDocument: 'after' });
return res.value.opcount;
} catch (e) {
if (e.message.includes('duplicate')) throw new OpcountExceededError(op, periodSecs, maxOperations);
throw e;
}
return -1;
}
bus.once('app/started', () => db.ensureIndexes(