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

TP2000-1685 Fix packaging, envelope queue regression whilst guarding against race conditions #1399

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

dalecannon
Copy link
Contributor

@dalecannon dalecannon commented Jan 28, 2025

TP2000-1685 Fix packaging, envelope queue regression whilst guarding against race conditions

Why

The setting of a packaged workbasket's processing_started_at field wasn't taking effect.

Inside PackagedWorkBasket.begin_processing(), the variable instance was used to set timestamp value of the packaged workbasket being processed. However, the function's decorator, @save_after, relied on a different reference, self, which lacked the new timestamp value. When the decorator called self.save(), the processing timestamp of the packaged workbasket would remain as its default value of null.

What

  • Reinstates the reverted PR TP2000-1577 Correct usage of select_for_update() in packaged workbasket instance methods #1358

  • Checks that the processing timestamp is not null following a transition from awaiting processing to currently processing in test_success_processing_transition unit test

  • Sets the processing timestamp value on self instead of instance in PackagedWorkBasket.begin_processing(), ensuring the most up-to-date reference of the packaged workbasket instance propagates through function decorators. (Note that other queue management function use @refresh_after decorator instead).

  • Adds an additional test case to TestPackagingQueueRaceConditions

  • Ensures lingering thread-local DB connections inside TestPackagingQueueRaceConditions are closed to avoid warnings/errors about test DB teardown and creation

@dalecannon dalecannon marked this pull request as ready for review February 4, 2025 17:11
@dalecannon dalecannon requested a review from a team as a code owner February 4, 2025 17:11
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.

1 participant