v1.6.0/cleanup fix
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user