[16.0] Add 'Allow Commit' option on job functions#910
[16.0] Add 'Allow Commit' option on job functions#910
Conversation
It is forbidden to commit inside a job, because it releases the job lock and can cause it to start again, while still being run, by the dead jobs requeuer. For some use cases, it may actually be legitimate, or at least be needed in the short term before actual updates in the code. A new option on the job function, false by default, allow to run the job in a new transaction, at the cost of an additional connection + transaction overhead. Related to OCA#889
False on new databases, True on existing databases. Should always be False by default on future versions.
This reverts commit b4f3bec.
As the controller changes env on Job instances.
|
@guewen I kind of remember you could set |
|
@sbidoul It was only in your head 😂 I didn't think about that. Do you see a use case for this? For methods that accept a "commit=True" parameter? |
|
On adapting |
|
Yes that was what prompted my question ^. |
|
I suppose most of the time, we know ahead of time when a job method will/should commit or not, so it makes more sense on the job function. If you had to set |
|
@lmignon is this good to go? |
Backport of #899