Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@AlexandreEXFO
Copy link
Contributor

Changes

Resolution of the error that sometimes occurs: "Error: sleep length must be non-negative"

Documentation and testing

Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated:

@AlexandreEXFO AlexandreEXFO changed the title fix: Rate limit issue fix(utils): prevent negative sleep time in rate limit retry Dec 4, 2025
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.72%. Comparing base (9f11323) to head (895874f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3308   +/-   ##
=======================================
  Coverage   95.72%   95.72%           
=======================================
  Files          98       98           
  Lines        6052     6052           
=======================================
  Hits         5793     5793           
  Misses        259      259           
Flag Coverage Δ
api_func_v4 83.69% <0.00%> (+0.04%) ⬆️
cli_func_v4 78.68% <0.00%> (ø)
unit 90.18% <100.00%> (ø)

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

Files with missing lines Coverage Δ
gitlab/utils.py 98.59% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexandreEXFO
Copy link
Contributor Author

@JohnVillalovos: Could you take a look at this change? Please

gitlab/utils.py Show resolved Hide resolved
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 fixes a bug where negative sleep times could occur when processing rate limit responses with RateLimit-Reset headers that contain timestamps in the past.

Key changes:

  • Added max(0, ...) guard to prevent negative wait time calculation when RateLimit-Reset timestamp is in the past

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gitlab/utils.py Show resolved Hide resolved
Copy link
Member

@JohnVillalovos JohnVillalovos left a comment

Choose a reason for hiding this comment

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

Thanks @AlexandreEXFO

LGTM

@JohnVillalovos JohnVillalovos enabled auto-merge (rebase) December 11, 2025 00:38
@JohnVillalovos JohnVillalovos merged commit 4221195 into python-gitlab:main Dec 11, 2025
16 checks passed
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.