Files
arena-tracker/crates/core/src/follow/priority.rs
T
nessarandClaude Opus 5.5 1eebb86902 Call Riot through the relay, without a key (#149)
Every Riot call goes to {relay}/{routing value}{Riot path} and sends no
key. The relay's address is built in (arena-tracker.nessar.fr);
relay_url in config.toml replaces it for development. A riot_api_key
left by an older version is never read, and is written back on save.

The personal keys' local pacing is gone. An import waits out each
Retry-After as often as it comes (at least a second each time), and so
do Mastery requests. A 5xx is the service unavailable, with its own
banner; a 401/403 is a refusal, which for a timeline the Match itself
confirms before it is stored, so a key failing on the relay's side
stores no refused Death Recap.

The first-launch key prompt, the key field in « Paramètres » and the
Friend refusal's « Paramètres » button are removed; the follower starts
with the app. KeyForm, KeyStore and KeyEvent become SettingsForm,
SettingsStore and SettingsEvent. README, user guide and interface spec
no longer ask for a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 13:44:58 +01:00

36 lines
1.3 KiB
Rust

//! The active Account first: a Friend's import makes each of its requests only while the
//! follower has no Riot work running and no finished game waits for its Match. Both wait out
//! the relay's `Retry-After` when its quota is full.
use std::sync::PoisonError;
use crate::tracker::Tracker;
/// The follower is at work (a round, a refresh) until this is dropped, also by a panic.
pub(super) struct FollowerBusy<'a>(&'a Tracker);
impl Drop for FollowerBusy<'_> {
fn drop(&mut self) {
self.0.follow().busy -= 1;
self.0.follower_idle.notify_all();
}
}
impl Tracker {
pub(super) fn follower_busy(&self) -> FollowerBusy<'_> {
self.follow().busy += 1;
FollowerBusy(self)
}
/// Blocks while a round or a refresh runs, or while the Match of a finished game is still
/// awaited (up to `MATCH_RETRIES` rounds), so that the active Account's requests go first.
/// Sleeps on `follower_idle`, which the end of each round signals: no polling. Never call it
/// from the follower's thread, whose rounds it waits for.
pub(crate) fn wait_for_follower(&self) {
let mut follow = self.follow();
while follow.busy > 0 || !follow.pending.is_empty() {
follow = (self.follower_idle.wait(follow)).unwrap_or_else(PoisonError::into_inner);
}
}
}