Skip to content

Commit

Permalink
Correct clean-db
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-asriyan committed Aug 24, 2024
1 parent 8c1722d commit c1d4b05
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/clean-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ jobs:
- name: Clean
run: make dev_clean_db

6 changes: 3 additions & 3 deletions clean-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const main = async function() {
if (typeof updatedAt !== 'number') {
process.stdout.write(`room#${childSnapshot.key}\twrong type: ${typeof updatedAt}\n`);
} else if (updatedAt < now - diff) {
process.stdout.write(`room#${childSnapshot.key}\tupdated ${Math.round((now - updatedAt) / 60 / 60 / 24)} hours ago\n`);
process.stdout.write(`room#${childSnapshot.key}\tupdated ${Math.round((now - updatedAt) / 60 / 60 / 24)} days ago\n`);
} else if (updatedAt > now + diff) {
process.stdout.write(`room#${childSnapshot.key}\tupdated ${Math.round((updatedAt - now) / 60 / 60 / 24)} hours ahead (in future)\n`);
process.stdout.write(`room#${childSnapshot.key}\tupdated ${Math.round((updatedAt - now) / 60 / 60 / 24)} days ahead (in future)\n`);
} else {
return;
}
await childSnapshot.ref.remove();
// await childSnapshot.ref.remove();
++count;
})();
promises.push(task);
Expand Down
2 changes: 1 addition & 1 deletion stats.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import admin from 'firebase-admin';
import { ref, onValue, get } from 'firebase/database';
import { get } from 'firebase/database';
import serviceAccount from './service-account-key.json' assert { type: "json" };

admin.initializeApp({
Expand Down

0 comments on commit c1d4b05

Please sign in to comment.