-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] Cancel enqueued task #1753
Comments
I found a few problems with this issue:
|
Internal feature request number 235998431 |
Hey, I'd like to add here that being able to specify the name of the task would be better for me than getting an auto-generated name. Use-case: I want to have a Firestore-triggered Cloud Function that will enqueue the task when a document is created. If I can specify the task name, I just create the document with a |
Both features have been submitted for API review, which is a formal step before any implementation can begin. One thing I realized during my research though is that autogenerated document IDs make horrible task IDs. Task queue IDs are used for sharding, so sequences of increasing numbers (like timestamps) cause scaling problems. Automatic document IDs are based on timestmaps and will cause problems. A solution is to reverse the string with |
Thanks for the update, @inlined. The IDs generated by Firestore are good for sharding, right? |
Indeed. That code is for truly unique IDs. I thought Firestore was like the Realtime Database, which uses base64 encoded timestamps along with an anti-collision nonce. |
Somewhat related: I wanted to set task name myself, so I can use the Cloud Tasks automatic deduplication. |
I am running into the same issue. I want to prevent the tasks in the queue from being duplicated. It seems the only solution is to manually set a task name in the code. When this is supported than I wont need to clear or cancels tasks by myself |
They just released v11.10.0 which provides a way to cancel enqueued tasks: https://github.com/firebase/firebase-admin-node/releases/tag/v11.10.0 🥳 |
Is your feature request related to a problem? Please describe.
Not applicable.
Describe the solution you'd like
I need to be able to cancel a task that was enqueued, like this pseudo-code:
Describe alternatives you've considered
Maybe there's some way to cancel the task using
@google-cloud/tasks
directly, but I didn't try yet.EDIT: Apparently, it's not possible because the task ID is not returned by
firebase-admin
.Additional context
I've also asked on StackOverflow, but I think it's really a missing feature: https://stackoverflow.com/questions/72549309/how-to-cancel-a-task-enqueued-on-firebase-functions
The text was updated successfully, but these errors were encountered: