Make job Context transaction optional #96
victoronascimento
started this conversation in
Ideas
Replies: 1 comment
-
|
@kirillsalykin and I also discussed this a bit previously. I agree there are use cases where you don't need it, it doesn't actually help, or it introduces unneeded and unwanted latency or potential issues with connection counts. That said, when you do want it, it's essential. It's a headline feature of this crate because of that. This is actually a property of the worker which is provided to the job. So both the worker and job would need to be changed to accommodate in some way. |
Beta Was this translation helpful? Give feedback.
0 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 @maxcountryman ! Once again, thanks for this nice library!
I think that one of the many cases we want to have background jobs is for interfacing with external systems (like sending an email as in the examples).
The problem about having an open transaction when calling external systems is that the latency is naturally not controlled by the job. So, our connection pool might saturate faster if anything on the external system hangs the connection for any reason.
Also, when dealing with external systems, the fact we have a transaction does not make all side-effects ACID per se. There are possible scenarios like getting a connection error when the side effect on the external system is already persisted. Even if we rollback the transaction it will not "undo" the side-effect on the external system.
I think the ability to have an open transaction for every job step execution should be optional. Maybe even, off by default.
It could be part of
JobBuilderan extra option.Beta Was this translation helpful? Give feedback.
All reactions