Skip to content
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

[15.0] [ENH] queue_job: identity_key enhancements #545

Conversation

richard-willdooit
Copy link

  1. In production, a job which is waiting dependencies or which has started, but not completed, should not be repeated if the identity_key matches.
  2. In tests, the mock queue handler is now enhanced to allow better mimicking of the identity_key blocks from production.
  3. In tests, the mock queue handler now clears the enqueued jobs after performing them, to better reproduce what a production environment would do.

1. In production, a job which is waiting dependencies or which
has started, but not completed, should not be repeated if
the identity_key matches.
2. In tests, the mock queue handler is now enhanced to allow
better mimicking of the identity_key blocks from production.
3. In tests, the mock queue handler now clears the enqueued jobs
after performing them, to better reproduce what a production
environment would do.
@OCA-git-bot
Copy link
Contributor

Hi @guewen,
some modules you are maintaining are being modified, check this out!

Copy link

@abhinavvaidya-tsd abhinavvaidya-tsd left a comment

Choose a reason for hiding this comment

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

Suggestion added

Comment on lines +260 to +262
patcher = mock.patch.object(job, "store")
self._store_patchers.append(patcher)
patcher.start()

Choose a reason for hiding this comment

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

Suggested change

    with mock.patch.object(job, "store") as patcher:
        self._store_patchers.append(patcher)

Context Manager: Used the with statement to create a context for the mock patcher. This ensures that the patcher's cleanup (stop()) is automatically handled even if an exception occurs.

By using the with statement, you ensure that the patcher is properly started and stopped, avoiding potential issues with resource leaks or incorrect mocking behavior.

@simahawk
Copy link
Contributor

changes to be backported from #587

@simahawk
Copy link
Contributor

Finished in #590 as per #587 and #581

@simahawk simahawk closed this Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants