-
-
Notifications
You must be signed in to change notification settings - Fork 536
[ON HOLD][13.0] Add job_auto_delay decorator #270
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
Conversation
lmignon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and good idea! (Code review)
It makes every calls to "cron_actions" run in queue jobs. The jobs have an identity key with "identity_exact", meaning that only one occurence of a job for the same buffer with the same arguments (only_nfp) will be created at a time (e.g. when the state of a stock.move is changed several times in the same transaction or in a different transaction in a short timeframe). It needs OCA/queue#270
jgrandguillaume
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so elegant 👍
simahawk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, just small glitches.
BTW what about #255 ?
cd49316 to
9659afe
Compare
|
@simahawk I fixed the small glitches and force-pushed directly |
etobella
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea @guewen this is something I always needed and had to solve using context keys. This is much more cleaner 😄
|
Do not merge yet, I'm investigating an error: And I suspect it happens when other modules redefine the same method. To be continued... |
I confirm this. I hope I can find a way to prevent this. |
This is not an issue only with module_b and module_c have no dependencies on each other. In It seems that depending on the loading order, we'll lose the properties added by |
This is a new decorator, to use instead of @job on methods, that transforms a method to a method automatically delayed as job when called. A typical use case is when a method in a module we don't control is called synchronously in the middle of another method, and we'd like all the calls to this method become asynchronous.
9659afe to
68d6bc0
Compare
This is a new decorator, to use instead of
@jobon methods,that transforms a method to a method automatically delayed as job when
called.
A typical use case is when a method in a module we don't control is called
synchronously in the middle of another method, and we'd like all the calls
to this method become asynchronous.
Closes #238