Hello,
I'm here again with another question regarding your backend solution and more specifically, the execution of cloud code and notifications.
In our app, each user is able to vote for items with either a "Like" or a "Dislike". Every time a new vote is made on an item, I want to inform the owner of the item that a vote has been made through a notification. This works great.
However, I want to allow users to make mistake in the sense that if a user unintentionally taps "Dislike" and then reverts his vote right away to "Like", I don't want to send 2 different notifications to the item's owner. The behavior of the Backend should be something like, when a vote is made, wait for a certain duration (lets say 30 seconds) then, send a notification to the item's owner with the current vote.
I know that I can delay notifications (for the chosen duration) but I believe that the payload must be constructed on creation and that it can not be updated afterwards, am I right? Hence, this is not useful because the Backend can not be sure of the state of the vote 30 seconds after creating the payload.
The other option would then be to delay the creation of the notification payload. We handle the notification through a cloud function, so is it possible to plan the execution of a cloud function with a certain delay? Obviously, without interfering with the constrain that the cloud function must be run within a 10 second interval to not be canceled (execution timeout).
Thank you very much for your help on this matter and for all the amazing support that you are providing (either here on the forum or by phone call)!
Best.