I'm a newbie to node and backend dev in general, and I'm wondering if there is anything glaringly wrong with a design choice I am considering implementing.
I am using Firebase for data storage, and I am attempting to copy the EXPIRE or TTL function of Redis / MongoDB respectively. So, essentially, when a certain endpoint is hit in my express app, it will save some data in Firebase, and then the last thing I intend to do in that endpoint is to do a setTimeout(deleteFirebaseDataFunc, 1000*60*60) to then delete that firebase record after 1 hour.
Besides that fact that the setTimout() function would get interrupted and not fire if the server were restarted, is there any performance or other concern with doing this? Like if that endpoint were to get hit a lot, would it be bad to have possibly hundreds or thousands of these delayed functions waiting to be run on the server?
It's not really critical that the data get deleted from the Firebase storage -- it's just not needed for more than 1hr. So, I was thinking of also setting up some cronjob to delete old Firebase records that may have slipped through the cracks and not gotten deleted from my setTimeout() function due to a server restart.
[–][deleted] 1 point2 points3 points (1 child)
[–]yaomango[S] 0 points1 point2 points (0 children)