Skip to content

fix: token validation caching and metagraph index safety#319

Open
jjjj-lgtm wants to merge 1 commit intoentrius:testfrom
jjjj-lgtm:feature/token-validation-cache-test
Open

fix: token validation caching and metagraph index safety#319
jjjj-lgtm wants to merge 1 commit intoentrius:testfrom
jjjj-lgtm:feature/token-validation-cache-test

Conversation

@jjjj-lgtm
Copy link
Copy Markdown

Bug fixes:

  1. Token validation now cached for 5 minutes to avoid GitHub API rate limiting

    • Previously validated on EVERY request, causing unnecessary API calls
    • Now caches result and only re-validates when token changes or cache expires
  2. Fixed ValueError crash in blacklist() and priority()

    • Both functions used list.index() which throws ValueError if element not found
    • Now wrapped in try/except to handle missing hotkeys gracefully
  3. Added proper rate limiting handling in is_token_valid()

    • Handles 429 responses with backoff
    • Handles 401 (unauthorized) without retries

Improves miner reliability and prevents crashes from race conditions.

Bug fixes:
1. Token validation now cached for 5 minutes to avoid GitHub API rate limiting
   - Previously validated on EVERY request, causing unnecessary API calls
   - Now caches result and only re-validates when token changes or cache expires

2. Fixed ValueError crash in blacklist() and priority()
   - Both functions used list.index() which throws ValueError if element not found
   - Now wrapped in try/except to handle missing hotkeys gracefully

3. Added proper rate limiting handling in is_token_valid()
   - Handles 429 responses with backoff
   - Handles 401 (unauthorized) without retries

Improves miner reliability and prevents crashes from race conditions.
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