v1.3.2-beta/URGENT PATCH FIX, clean up fix
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
const admin = require('firebase-admin');
|
||||
const FunctionModules = require('./index');
|
||||
|
||||
const timeDiff = (ds1, ds2) => {
|
||||
const d1 = new Date(ds1);
|
||||
const d2 = new Date(ds2);
|
||||
var diff = (d2.getTime() - d1.getTime()) / 1000;
|
||||
diff /= 60 * 60;
|
||||
return Math.abs(Math.round(diff));
|
||||
};
|
||||
|
||||
module.exports = async () => {
|
||||
const startedTime = new Date();
|
||||
@@ -19,10 +26,10 @@ module.exports = async () => {
|
||||
.get()
|
||||
.then(async (roomSnap) => {
|
||||
if (
|
||||
FunctionModules.timeDiff(roomSnap.createTime.toDate(), startedTime) >= 24 ||
|
||||
FunctionModules.timeDiff(roomSnap.updateTime.toDate(), startedTime) >= 12
|
||||
timeDiff(roomSnap.createTime.toDate(), startedTime) >= 24 ||
|
||||
timeDiff(roomSnap.updateTime.toDate(), startedTime) >= 12
|
||||
)
|
||||
await FunctionModules.cleanUpRoom(roomSnap.id);
|
||||
await FunctionModules2.cleanUpRoom(roomSnap.id);
|
||||
console.info(`Deleted room ${roomSnap.id} from auto cleanup`);
|
||||
return;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user