WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@drazisil-codecov
Copy link
Contributor

  • Add with_logged_lock() context manager to BaseCodecovTask for consistent lock logging
  • Refactor all tasks to use centralized lock logging method
  • Remove duplicate lock logging code from:
    • upload.py
    • preprocess_upload.py
    • sync_repos.py
    • sync_pull.py
    • manual_trigger.py
    • crontasks.py
    • upload_finisher.py
  • All locks now log: Acquiring lock, Acquired lock, Releasing lock (with duration)
  • No changes to actual lock logic, only added observability

- Add with_logged_lock() context manager to BaseCodecovTask for consistent lock logging
- Refactor all tasks to use centralized lock logging method
- Remove duplicate lock logging code from:
  - upload.py
  - preprocess_upload.py
  - sync_repos.py
  - sync_pull.py
  - manual_trigger.py
  - crontasks.py
  - upload_finisher.py
- All locks now log: Acquiring lock, Acquired lock, Releasing lock (with duration)
- No changes to actual lock logic, only added observability
@linear
Copy link

linear bot commented Nov 26, 2025

@sentry
Copy link

sentry bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.86%. Comparing base (b980824) to head (7c572eb).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #588   +/-   ##
=======================================
  Coverage   93.86%   93.86%           
=======================================
  Files        1284     1284           
  Lines       46478    46492   +14     
  Branches     1522     1522           
=======================================
+ Hits        43628    43642   +14     
  Misses       2540     2540           
  Partials      310      310           

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

@codecov-eu
Copy link

codecov-eu bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

- Add comprehensive test suite for with_logged_lock() context manager
- Test that 'Acquiring lock' is logged before lock acquisition
- Test that 'Acquired lock' is logged after successful acquisition
- Test that 'Releasing lock' is logged with duration after release
- Test that extra context is included in all log messages
- Test that code executes correctly within lock context
- Test that LockError propagates correctly (not caught)
- Test that 'Releasing lock' is logged even on exceptions
@codecov-notifications
Copy link

codecov-notifications bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Use approximate comparison instead of exact equality for lock_duration_seconds
to handle floating point precision issues
Updated assertions in test_base.py to use multi-line format for better clarity in floating point precision checks for lock_duration_seconds.
@drazisil-codecov
Copy link
Contributor Author

@sentry review

Modify get_report_lock to return both lock and lock_name as a tuple,
eliminating duplication and ensuring the lock_name passed to with_logged_lock
always matches the actual lock being used. This prevents potential bugs if
get_report_lock's internal lock naming logic changes in the future.
Removed comments verifying log messages in unit tests.
@drazisil-codecov drazisil-codecov added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit b081221 Dec 1, 2025
41 checks passed
@drazisil-codecov drazisil-codecov deleted the CCMRG-1903-centralize-lock-logging branch December 1, 2025 10:25
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