Skip to content

Conversation

@maximusunc
Copy link
Collaborator

No description provided.

@maximusunc maximusunc requested a review from dkoslicki June 5, 2025 14:41
@codecov
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 67.85714% with 9 lines in your changes missing coverage. Please review.

Project coverage is 46.10%. Comparing base (a1fe192) to head (4c14716).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
shepherd_utils/broker.py 65.21% 4 Missing and 4 partials ⚠️
workers/merge_message/worker.py 80.00% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
workers/merge_message/worker.py 81.76% <80.00%> (+0.10%) ⬆️
shepherd_utils/broker.py 61.72% <65.21%> (+10.44%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eed012d...4c14716. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@dkoslicki dkoslicki left a comment

Choose a reason for hiding this comment

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

Claude is complaining about a possible race condition between subscribing and acquiring the lock. I don't know if you think this matters or not

pubsub = client.pubsub()
await pubsub.subscribe(response_id)
for i in range(12):
aquired = await client.set(response_id, consumer_id, ex=45, nx=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

acquired? Minor typo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 70538e6

await pubsub.subscribe(response_id)
for i in range(12):
aquired = await client.set(response_id, consumer_id, ex=45, nx=True)
if aquired:
Copy link
Collaborator

Choose a reason for hiding this comment

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

acquired? Minor typo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 70538e6

await pubsub.unsubscribe(response_id)
await pubsub.aclose()
await client.aclose()
return got_lock
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the next line, and at other exceptions, do we need to cleanup the pubsub and unsubscribe, or does that not much matter? I do very little async coding, so might not even be a valid question

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved those down to a finally and check if they're initialized: 4c14716

@maximusunc
Copy link
Collaborator Author

Claude is complaining about a possible race condition between subscribing and acquiring the lock. I don't know if you think this matters or not

I don't think Claude is correct in this case. The client.pubsub() just returns an async object with awaitable functions.

@maximusunc maximusunc requested a review from dkoslicki June 5, 2025 16:56
@maximusunc maximusunc merged commit 75b82c5 into main Jun 9, 2025
3 checks passed
@maximusunc maximusunc deleted the fix_redis_locking branch June 9, 2025 19:22
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.

3 participants