I'm currently facing an issue with trying to delay certain actions using Cloud Firestore. Despite my attempts, the setTimeout/setInterval functions don't seem to be working as expected in my code.
export const onTimerCreate = functions.firestore
.document("File/One")
.onCreate((snapshot, context) => {
setTimeout(countdown, 5000);
const messageData = snapshot.data()
const delay = countdown()
return snapshot.ref.update ({ delay : delay })
})
function countdown() {
return 0
}
My goal is to ensure that the snapshot updates with a new value after a delay of 5 seconds, but it seems to happen instantly every time. I'm unsure of what steps to take next - any suggestions?