Skip to content

fix: don't count transient RPC errors toward market deactivation (N2)#100

Open
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/n2-transient-error-classification
Open

fix: don't count transient RPC errors toward market deactivation (N2)#100
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/n2-transient-error-classification

Conversation

@0x-SquidSol
Copy link
Copy Markdown
Contributor

Summary

  • crankMarket() catch block incremented consecutiveFailures for all errors, including transient RPC errors (429, timeout, socket reset, 502/503)
  • After 10 consecutive transient errors (common during RPC provider hiccups), a healthy market was deactivated until the next discovery cycle (5 min)
  • Now classifies errors: transient RPC/network errors are logged but do NOT count toward deactivation
  • Only deterministic program-level errors increment consecutiveFailures

Transient error patterns detected

429, too many requests, rate limit, timeout, socket, econnrefused, econnreset, 502, 503, block height exceeded

Test plan

  • All 133 tests pass
  • Matches the transient error classification already used by liquidation.ts fetchSlabWithRetry()

🤖 Generated with Claude Code

The crankMarket() catch block incremented consecutiveFailures for ALL
errors including transient ones (429, timeout, socket reset, 502/503).
After 10 consecutive transient errors — common during RPC provider
hiccups — a perfectly healthy market was deactivated until the next
discovery cycle (5 min default).

Now classify errors before incrementing: transient RPC/network errors
(429, rate limit, timeout, socket, ECONNREFUSED, 502, 503, block
height exceeded) are logged at warn level but do NOT increment
consecutiveFailures. Only deterministic program-level errors count
toward deactivation.

Matches the transient error classification pattern already used by
liquidation.ts fetchSlabWithRetry().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Warning

Rate limit exceeded

@0x-SquidSol has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 49 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 49 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bddb8348-db21-432e-bace-0cf72e30e125

📥 Commits

Reviewing files that changed from the base of the PR and between 3280971 and 93f2143.

📒 Files selected for processing (1)
  • src/services/crank.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

1 participant