Skip to content

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

Closed
richard-willdooit wants to merge 1 commit into
OCA:15.0from
richard-willdooit:15.0-identity_key_enhancements
Closed

[15.0] [ENH] queue_job: identity_key enhancements#545
richard-willdooit wants to merge 1 commit into
OCA:15.0from
richard-willdooit:15.0-identity_key_enhancements

Conversation

@richard-willdooit

Copy link
Copy Markdown
  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
Copy Markdown
Contributor

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

@abhinavvaidya-tsd abhinavvaidya-tsd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion added

Comment thread queue_job/tests/common.py
Comment on lines +260 to +262
patcher = mock.patch.object(job, "store")
self._store_patchers.append(patcher)
patcher.start()

Copy link
Copy Markdown

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
Copy Markdown
Contributor

changes to be backported from #587

@simahawk

Copy link
Copy Markdown
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