mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
* feat(ra): sync a player's achievements after they play an RA game RetroAchievements progress only synced nightly (and only when the scheduled task is enabled) or by hand from Settings, so achievements earned in a session didn't show in RomM until much later. When a play session is recorded for a ROM matched to RetroAchievements, queue an incremental progress sync for that user on the low-priority queue. Every play path (web player, streaming, device sync) records its sessions through ingest_play_sessions, so all of them trigger it. A fixed job id keeps one sync per user queued at a time. The per-user sync body moves out of the scheduled task so both share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT * fix(ra): queue the after-play sync under a valid id that a failure can't hold The job id used a colon, which RQ rejects, so every enqueue raised and was logged instead of queued. Use an underscore. With unique=True, RQ refuses any job whose id still exists, and a failed job is kept for failure_ttl (a year by default). One failed sync would have blocked that user's after-play syncs. The job now logs its own errors instead of failing, and failure_ttl is capped for a worker that dies mid-run. Add tests against the real queue: one job per user, and the id is free again after a sync succeeds or fails. Also drop the docstring's Raises block and narrow await_args before reading it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT * fix(ra): give the after-play sync the RetroAchievements task's timeout It used RQ's 180s default, which a first sync of a large account can exceed. Use the scheduled sync's configured timeout (TASK_TIMEOUT). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>