Skip to content

Add pacing, backoff, duplicate detection, and structured logging to recognition loop - #1

Open
juaneloti wants to merge 1 commit into
docker_v1.0from
adding_logs_and_rate_limiting
Open

Add pacing, backoff, duplicate detection, and structured logging to recognition loop#1
juaneloti wants to merge 1 commit into
docker_v1.0from
adding_logs_and_rate_limiting

Conversation

@juaneloti

Copy link
Copy Markdown
Owner

Summary:

  • Added structured logging (INFO + DEBUG) for each recognition attempt (match / no_match / error) with sleep timing.
  • Implemented pacing: hold period after a successful match (default 5 min), minimum interval between unknown attempts, jitter to reduce bot‑like patterns.
  • Added exponential backoff and longer pause after repeated failures; prevents hammering Shazam endpoints.
  • Skips duplicate audio by hashing recorded snippet (SHA1) to avoid re-sending identical data too soon.
  • Hardened audio capture: falls back to silence if device errors/overflows, preventing thread crash.
  • Resilient config loader now tolerates inline # comments and missing keys (adds pacing defaults).
  • Added safe cover art fetch with timeout and logging; history writing wrapped in try/except.

Why:

Improves stability, reduces risk of rate limiting, makes troubleshooting easier, and avoids wasted recognition calls.

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