Replies: 1 comment 6 replies
-
|
@chaporgin OOC: It seems like if you're trying to guarantee an immediate run, the more obvious path would be to just take the work and run it right in band with the operation that would've enqueued it. i.e. Bypassing the job queue completely. Is the purpose of the job queue in this instance to get tracking on it in case of failure? It does seem like this would be doable one way or the other, although it'd need a separate locking query, and those are always a little gnarly.
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, thank you for the library. I have been kicking tires here and there for my idea: provide an ability to execute the inserted job immediately in the same process that has just closed the transition scheduling the job. Yes, it's tricky because the transaction might span further after the job was inserted, so it's impossible to start it in the
Insert{,Many}family of methods. But perhaps a dedicated method like Client.Start(ctx, jobId int64) could do the job if a user explicitly calls it after committing the transition. How hard would it be to implement, WDYT? The motivation is to reduce latencies and not rely too much on NOTIFY/LISTEN and polling. The worst thing (correct me if I'm wrong here) that could happen is that the client learns that the job written in the database has already been locked. It could return a dedicated error to the user saying that "the row has been locked and the job is being executed by some other process already", which the client should be ready for.Beta Was this translation helpful? Give feedback.
All reactions