There is one type of problem I'm facing in multiple projects that I haven't yet found a good solution for within the Google Cloud services.
I would like to queue/defer some work originating from user action, in such a way that the task handler processes multiple "duplicate" items as one.
For example, an email needs to be sent out when a user enables some feature, but also when the feature is disabled again. In the UI the feature can be easily toggled. I want to prevent sending multiple emails if the user is indecisive and happens to turn the toggle on and off multiple times in a short interval.
Ideally, I would place all these events in a queue like cloud tasks, tagging them with some sort of common identifier. Then, have a handler (probably triggered by a cron job), fetch a task, but then immediately fetch all other queued tasks that share that common identifier. This way the handler could figure out if eventually the feature was enabled or disabled, or maybe it was a no-op because first it was enabled and then disabled again. So only a maximum of 1 email is sent out at any cron cycle for tasks sharing the common identifier.
At least that's how I see it working in my mind. Possibly there's a better way.
I could roll my own solution using Firestore, as I have done in the past when I needed to queue items that had to be scheduled weeks from now, but I feel that in this case, the problem is common enough that there must be existing solutions for it.