honeydew icon indicating copy to clipboard operation
honeydew copied to clipboard

Add a documented way to select finished ecto queue jobs

Open futpib opened this issue 5 years ago • 2 comments

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.

https://github.com/koudelka/honeydew/blob/b60b639d6b2b3253f1bb20246df48ab54e6858ae/lib/honeydew/sources/ecto_source.ex#L8-L14

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

futpib avatar Nov 19 '19 15:11 futpib

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?

koudelka avatar Nov 21 '19 06:11 koudelka

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.

futpib avatar Nov 21 '19 10:11 futpib