v1.6.0/cleanup fix

This commit is contained in:
2020-08-08 19:04:31 -04:00
parent ff07646657
commit 17a0355a4f
2 changed files with 47 additions and 33 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
const admin = require('firebase-admin');
const cleanUpRoom = require('./cleanUpRoom');
const admin = require("firebase-admin");
const cleanUpRoom = require("./cleanUpRoom");
const timeDiff = (ds1, ds2) => {
const d1 = new Date(ds1);
@@ -11,10 +11,10 @@ const timeDiff = (ds1, ds2) => {
module.exports = async (req, res) => {
const startedTime = new Date();
res.status(200).send({message:'Started processing'});
res.status(200).send({ message: "Started processing" });
const roomList = await admin
.firestore()
.collection('rooms')
.collection("rooms")
.listDocuments()
.then((rL) => rL)
.catch((err) => {
@@ -34,7 +34,7 @@ module.exports = async (req, res) => {
// LESS THAN 24 HOURS BUT NOT IN USE
timeDiff(roomSnap.updateTime.toDate(), startedTime) >= 12
) {
await cleanUpRoom(roomSnap.id);
cleanUpRoom(roomSnap.id);
console.info(`Deleted room ${roomSnap.id} from auto cleanup`);
}
return;