Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 3x 3x 3x 1x 1x 2x 1x 1x 1x | const { db } = require('../utils/firebase');
const log = require('../utils/log');
async function expireTempIds() {
const nowMs = Date.now();
const snap = await db
.collection('users')
.where('tempUniqueIdExpiry', '<=', nowMs)
.where('tempUniqueIdExpiry', '>', 0)
.limit(500)
.get();
if (snap.empty) return;
const batch = db.batch();
for (const doc of snap.docs) {
batch.update(doc.ref, { tempUniqueId: null, tempUniqueIdExpiry: null });
}
await batch.commit();
log.info('cron', 'expireTempIds: expired temp IDs', { count: snap.size });
}
module.exports = expireTempIds;
|