Skip to content

Conversation

@wastaken7
Copy link
Collaborator

@wastaken7 wastaken7 commented Jan 29, 2026

Summary by CodeRabbit

  • New Features
    • Added a configurable delay before adding torrents so trackers have time to register hashes. Supports a global default (0 seconds) and per-tracker overrides, with input validation, sensible bounds, and logging for invalid or notable settings.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Adds a configurable inject_delay setting (default 0) and an async Clients.inject_delay() helper; Clients.add_to_client() now awaits this delay before resolving paths and injecting torrents.

Changes

Cohort / File(s) Summary
Configuration Addition
data/example-config.py
Added inject_delay under POST UPLOAD with default 0 seconds; supports per-tracker override.
Delay Implementation
src/clients.py
Added Clients.inject_delay(meta, tracker, client_name) async helper with validation, logging, and bounds; inserted await self.inject_delay(...) into add_to_client() before local/remote path computation and client injection.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nibble numbers, count the beats of time,
A patient pause, a tiny hop in rhyme,
Let trackers hum and register the key,
Then off we bounce to set the torrent free,
A quiet wait — then joyous upload chime.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: adding a configuration option to delay torrent injections before they are registered with the tracker.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch inject-delay

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

console.print("[bold red]CONFIG ERROR: 'inject_delay' must be >= 0")
inject_delay = 0
if inject_delay > 0:
if meta["debug"] or inject_delay > 5:
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'm not sure if this should always be printed or only if the delay is too long

@github-actions

This comment was marked as resolved.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/clients.py`:
- Around line 188-225: The inject_delay logic should prefer a tracker-specific
inject_delay even when it is 0 and must convert config values to int before
numeric comparisons; change the code in inject_delay to (1) read the raw tracker
value with something like tracker_inject_delay_raw =
self.config["TRACKERS"].get(tracker, {}).get("inject_delay") and detect presence
with "if 'inject_delay' in self.config['TRACKERS'].get(tracker, {})" so a 0 is
not treated as falsy, (2) choose the raw value = tracker_inject_delay_raw if
present else self.config["DEFAULT"].get("inject_delay"), (3) try to convert that
raw value to int in a try/except and on ValueError/TypeError log the CONFIG
ERROR (using tracker context when appropriate) and set inject_delay = 0, (4)
then perform the numeric checks (inject_delay < 0 and > 0) and await
asyncio.sleep(inject_delay) when > 0; update references to tracker_inject_delay
and inject_delay accordingly in the inject_delay method to ensure comparisons
are always against an int.

@github-actions

This comment was marked as resolved.

@wastaken7 wastaken7 requested a review from Audionut January 29, 2026 14:04
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