async function deleteOldPings()

in functions/garbageCollector.js [34:48]


async function deleteOldPings(batchSize, dateTo) {
  const db = admin.firestore();

  const pingsQuery = db.collection('pings')
    .where('addedAt', '<', dateTo)
    .limit(batchSize);
  const clientsQuery = db.collection('clients')
    .where('lastActive', '<', dateTo)
    .limit(batchSize);

  const numDeletedPings = await deleteQueryBatch(db, pingsQuery);
  console.log("Deleted pings: " + numDeletedPings);
  const numDeletedClients = await deleteQueryBatch(db, clientsQuery);
  console.log("Deleted clients: " + numDeletedClients);
}