Skip to content

Conversation

@artrixdotdev
Copy link
Owner

@artrixdotdev artrixdotdev commented Oct 30, 2025

#173

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a critical bug in the tracker's interval accessor that would cause the application to hang or crash when retrieving interval values.

@artrixdotdev artrixdotdev linked an issue Oct 30, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

Walkthrough

Fixed an infinite recursion bug in the HttpTracker interval accessor method. The method was incorrectly calling itself instead of reading the underlying AtomicUsize value directly, now corrected to use atomic load operation with Acquire ordering.

Changes

Cohort / File(s) Summary
HttpTracker interval accessor fix
crates/libtortillas/src/tracker/http.rs
Replaced recursive call self.interval() with direct atomic load self.interval.load(Ordering::Acquire) to prevent infinite recursion and enable proper thread-safe access to interval value

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single-file change with a straightforward accessor correction
  • Clear bug fix with obvious intent and minimal logic density
  • No API changes or structural modifications required

Possibly related issues

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 "fix: Self-calling method in http.rs" is directly related to the main change described in the raw summary. The changeset fixes an HttpTracker interval accessor that was incorrectly calling itself recursively (via self.interval()) instead of directly accessing the underlying AtomicUsize value. The title accurately captures this core issue by specifically naming "self-calling method" as the problem being fixed, and it appropriately identifies the affected file. The title is concise, clear, and avoids vague terminology, making it immediately understandable to someone scanning the repository history.
✨ 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 fix/http-tracker-recursion

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.

@artrixdotdev artrixdotdev merged commit 185d669 into main Oct 30, 2025
2 of 3 checks passed
@artrixdotdev artrixdotdev deleted the fix/http-tracker-recursion branch October 30, 2025 05:44
Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
crates/libtortillas/src/tracker/http.rs (1)

165-171: Consider removing duplicate inherent methods.

The inherent methods stats() and interval() (lines 165-171) duplicate the trait implementations (lines 260-266). Since both implementations are identical, you could remove the inherent methods and rely solely on the trait implementations, reducing maintenance burden. However, if the inherent methods are intentionally provided to avoid vtable dispatch overhead when the concrete type is known, this pattern is acceptable.

Also applies to: 260-266

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99ccbeb and a0fd414.

📒 Files selected for processing (1)
  • crates/libtortillas/src/tracker/http.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (1)
crates/libtortillas/src/tracker/http.rs (1)

264-266: Excellent fix for a critical infinite recursion bug!

The method now correctly loads from the atomic field instead of recursively calling itself. The previous implementation would have caused a stack overflow on every call to this trait method. The use of Ordering::Acquire is appropriate and pairs correctly with the Ordering::Release used in set_interval at line 174.

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.

Fix infinite recursion in HttpTracker::interval() trait method

2 participants