Skip to content
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

Api.clear_* functions doesn't clear unique_tokens #494

Open
dmitrykleymenov opened this issue Dec 9, 2024 · 4 comments
Open

Api.clear_* functions doesn't clear unique_tokens #494

dmitrykleymenov opened this issue Dec 9, 2024 · 4 comments

Comments

@dmitrykleymenov
Copy link

dmitrykleymenov commented Dec 9, 2024

If jobs have unique_tokens and we clear any queue, we have dead tokens without a chance to remove them. The same is true for remove_* functions

@ananthakumaran
Copy link
Collaborator

ananthakumaran commented Dec 9, 2024 via email

@dmitrykleymenov
Copy link
Author

dmitrykleymenov commented Dec 16, 2024

But what is the purpose of keeping tokens without jobs? For example, we have infinite TTL, cause we waiting for other services to up. And we can't remove tokens at all. May be an additional API function for removing it will do the trick. We just don't want to have "dead" values in Redis forever. If you agree, I can prepare pr for a new function or for removing tokens inside clear_* and remove_* function families.

@ananthakumaran
Copy link
Collaborator

But what is the purpose of keeping tokens without jobs?

There might be some weird cases, but I generally agree with you. When a user deletes a job, they might expect the token to be deleted as well. Adding a separate API to clear tokens would be overkill; it can be an option in the same function and default to true.

Please feel free to open a PR.

@ananthakumaran
Copy link
Collaborator

By the way, I am also not sure it's possible to delete all tokens since some tokens might be supplied by the user as well (not derived from job args). In that case, it's okay not to support those. Thinking again, it might be better to keep the default as false since there is no straightforward way to figure out if the job has unique tokens attached without doing additional redis operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants