Commit graph

8 commits

Author SHA1 Message Date
vrubelroman
028fd4d3e8 fix never-sent notifications for periods >= 3h, lower shared-token gap to 3s, handle both Lichess 429s
- periodic: stale-backlog suppression compared the window length with an absolute 2h,
  so every pair with period 180/360/720/1440 min was suppressed on every check
  (prod: 20 pairs of 16 users, 62 suppressions in 10 days). Now stale means the window
  exceeds the configured period by more than 2h (PeriodicMonitor._is_stale_backlog).
- SharedTokenGate min_gap 6s -> 3s. Measured with a separate test account: the JSON
  "Please only run N request(s) at a time" 429 is a concurrency limit (2 streams per
  IP / per token, slot freed at stream end) that a sequential client cannot trip, so
  the old 6s "cooldown" rationale was wrong; the HTML "Too many requests" 429 is an
  edge burst limiter (~0.45-0.9 req/s sustained) that 2-3s spacing avoids.
- lichess_client: on 429 log the body prefix (so the two limiters are distinguishable)
  and pause the gate 60s for the burst limiter only; re-raise exactly as before.
- /lastYear_or_1000games uses interactive priority (was waiting behind the backlog)
- /test_admin_notify only works from the admin chat
- stats service honours LOG_LEVEL and silences httpx INFO (bulk of its 808 MB log)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 21:55:30 +00:00
vrubelroman
7178b80854 split bot.py into periodic/notifications/onboarding modules, drop redundant request queue
Behaviour-preserving refactor:
- periodic.py: PeriodicMonitor (periodic_check & friends, moved verbatim with comments)
- notifications.py: one AdminNotifier for both processes (was 4 copies of the same
  direct-API code), with a 10 s HTTP timeout and the TTS announcer
- onboarding.py: link_player(), the add-player flow shared by /addgamer and /addtoken
- bot.py 2040 -> 1372 lines; no inline sqlite3 left (Database.gamer_exists/get_counts)
- request_queue.py removed: periodic checks call the local stats service under a
  10-slot semaphore; the only real Lichess limiter is SharedTokenGate in the service.
  Bot-side RateLimiter kept only for direct lichess.org calls.
- /addtoken "already tracked" check is now case-insensitive like /addgamer
- docs/CURRENT_STATE.md: system map as of 6355cd9 (analyst)
- .claude/agents: analyst / developer / tester definitions

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 21:46:48 +00:00
vrubelroman
75e62b57a1 remove admin web panel (LichessWebView) from the project
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 43s
Unused component that also carried several security issues (default
admin credentials, hardcoded Flask secret key, debug mode, plaintext
passwords). Cleaned up compose files, CI/CD pipeline, and docs
accordingly; also dropped the stale IS_PROD config docs in favor of
the current .env-based setup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-02 18:32:06 +00:00
vrubelroman
56c1048bcc adding docs 2025-11-20 14:19:08 +03:00
vrubelroman
c39bb33282 messages when doing questions 2025-11-16 23:10:08 +03:00
vrubelroman
7232a8d304 add about.md 2025-11-13 23:40:13 +03:00
vrubelroman
6cb5a9b99f Исправление двойного ответа и улучшение системы
- Исправлен баг с двойным ответом в /getgamers (добавлена обработка ошибок)
- Добавлена автоматическая миграция токенов при инициализации БД
- Исправлен веб-интерфейс - теперь берет токены из user_gamers
- Улучшен start.sh - создает бэкап базы перед перезапуском
- Добавлен export_db.sh для экспорта базы данных
- start.sh безопасно обновляет проект и сохраняет все данные
2025-10-28 21:34:35 +03:00
vrubelroman
a08fc8c962 Создание единого проекта Lichess Statistics Ecosystem
- Объединены три проекта в один репозиторий
- LichessWebServices - REST API для статистики
- LichessClientTG_bot - Telegram бот с поддержкой множества пользователей
- LichessWebView - Веб-интерфейс для просмотра пользователей и игроков
- Добавлен общий docker-compose.yml для запуска всех сервисов
- Добавлен скрипт start.sh для удобного запуска
- Добавлен README с полным описанием проекта
2025-10-26 20:23:26 +03:00