Skip to content

Conversation

@toluaina
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 43 lines in your changes missing coverage. Please review.

Project coverage is 81.57%. Comparing base (c3303f2) to head (0f6d8a6).

Files with missing lines Patch % Lines
pgsync/sync.py 34.84% 43 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #599      +/-   ##
==========================================
- Coverage   81.94%   81.57%   -0.38%     
==========================================
  Files          16       16              
  Lines        2703     2746      +43     
==========================================
+ Hits         2215     2240      +25     
- Misses        488      506      +18     
Flag Coverage Δ
unittests 81.57% <50.00%> (-0.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@toluaina toluaina requested a review from Copilot June 28, 2025 18:15

This comment was marked as outdated.

@toluaina toluaina requested a review from Copilot June 28, 2025 18:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for a Redis Delayed Queue using sorted sets by introducing a new numeric weight for prioritizing items. Key changes include adding and propagating the weight attribute in triggers and payloads, refactoring push/pop methods to use sorted sets, and incorporating new tests for validating weight-based ordering.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_trigger.py Updated trigger tests to include weight extraction in notifications
tests/test_sync.py Modified tests for slot truncation and payload flushing with weights
tests/test_redisqueue.py Added tests to verify correct ordering and score calculations in RedisQueue
pgsync/trigger.py Integrated weight handling in trigger logic
pgsync/sync.py Revised payload flushing and notification channel filtering
pgsync/redisqueue.py Reworked queue push/pop to utilize sorted sets with weight-based scoring
pgsync/base.py Extended payload structure with the weight property
examples/book/benchmark.py Added a new CLI option to set weight for benchmarking operations

if payloads:
self.redis.push(payloads)
payloads = []
self._flush_payloads(payloads)
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

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

After flushing payloads, the payloads list is not cleared. This may lead to duplicate processing of already flushed items; consider resetting the payloads list (e.g., payloads = []) after calling _flush_payloads.

Suggested change
self._flush_payloads(payloads)
self._flush_payloads(payloads)
payloads = []

Copilot uses AI. Check for mistakes.
Session = sessionmaker(bind=engine, autoflush=False, autocommit=False)
session = Session()

if weight:
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The condition 'if weight:' does not execute when weight is 0 (the default), which may be unintended. Consider explicitly checking for None or always setting the weight configuration regardless of its value.

Suggested change
if weight:
if weight is not None:

Copilot uses AI. Check for mistakes.
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.

2 participants