Firebase Cloud Functions Is Deleting Nodes Instantly Instead Of Deleting After 2 Hours
I'm using Cloud Functions to delete nodes after 2 hours on firebase.However, when I add a node, it is being deleted as soon as it is created inside the database My index.js: const
Solution 1:
Your timestamps are stored in seconds, not in milliseconds. Since your code uses Date.now
, which returns the timestamp in milliseconds, you're comparing values that are 1000x off.
The simplest solution is to:
const CUT_OFF_TIME = 2 * 60 * 60; // 2 Hours in seconds
Post a Comment for "Firebase Cloud Functions Is Deleting Nodes Instantly Instead Of Deleting After 2 Hours"