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

Add a documented way to select finished ecto queue jobs #96

Open
futpib opened this issue Nov 19, 2019 · 2 comments
Open

Add a documented way to select finished ecto queue jobs #96

futpib opened this issue Nov 19, 2019 · 2 comments

Comments

@futpib
Copy link

futpib commented Nov 19, 2019

I want to select all items that have been successfully processed by honeydew, I guessed by looking at the source code that I can use where([x], is_nil(x.honeydew_whatever_lock)) to do this, but this couples my code tightly against honeydew implementation details, I'd like a more "official" or "public" way to achieve this.

# 2. Indicates the status of the job, it can be either:
# - "ready", between zero and SQL.ready()
# - "delayed", between SQL.ready() and the beginning of the stale window
# - "in progress", from now until now + stale_timeout
# - "stale", within a year ago ago from now
# - "abandoned", -1
# - "finished", nil

A documented way to select jobs in a different state would be nice too, but this is not something I'm struggling with currently.

@koudelka
Copy link
Owner

Hey there. :)

What's your ideal API look like for this? An SQL fragment, or a function that adds a where clause to an Ecto query maybe?

@futpib
Copy link
Author

futpib commented Nov 21, 2019

Maybe a macro you can use in a where clause?

query
|> where([x], honeydew_is_finished(x, :classify_photos) and x.enabled == true)

It could expand into a right fragment.

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