Skip to content

[14.0] [IMP] queue_job - #350

Merged
OCA-git-bot merged 1 commit into
OCA:14.0from
ForgeFlow:14.0-imp-queue_job
May 27, 2021
Merged

[14.0] [IMP] queue_job#350
OCA-git-bot merged 1 commit into
OCA:14.0from
ForgeFlow:14.0-imp-queue_job

Conversation

@DavidBForgeFlow

Copy link
Copy Markdown

Add method to patch a method to be automatically delayed.
Cherry-pick from #275

This patch method has to be called in ``_register_hook``.
When a method is patched, any call to the method will not directly
execute the method's body, but will instead enqueue a job.
When a ``context_key`` is set when calling ``_patch_job_auto_delay``,
the patched method is automatically delayed only when this key is
``True`` in the caller's context. It is advised to patch the method
with a ``context_key``, because making the automatic delay *in any
case* can produce nasty and unexpected side effects (e.g. another
module calls the method and expects it to be computed before doing
something else, expecting a result, ...).
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.
It relies on OCA#274 that deprecates the
`@job` decorator.

@LoisRForgeFlowLoisRForgeFlow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@simahawk

Copy link
Copy Markdown
Contributor

/ocabot merge minor

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-350-by-simahawk-bump-minor, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 3d1f38a. Thanks a lot for contributing to OCA. ❤️

@LoisRForgeFlow
LoisRForgeFlow deleted the 14.0-imp-queue_job branch May 27, 2021 13:40
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@DavidBForgeFlow@simahawk@OCA-git-bot@LoisRForgeFlow@etobella