Scores keep updating with nobody watching
Reliability
Why it matters: Live scores no longer depend on someone keeping a browser tab open, so leaderboards stay current all day.
Score updates now run on the server as a scheduled background job, instead of a loop in an administrator’s browser. They start again on their own after an update to the site, and there is a one-click recovery if they ever stop.
Golfer names also match more reliably: accented names and the “(a)” amateur marker no longer cause a golfer’s score to be missed.
Commits (4)
-
e0f2e01Add Solid Queue background score scraper with admin start/stop control -
2444534Remove duplicate scrape creation from TournamentScraperService; add García alias -
f00c75aFix amateur (a) stripping and accented name matching -
386e55eWorker operational hardening: auto-start, reconcile on deploy, recovery button
Files Changed (23)
Gemfile | 2 +- Gemfile.lock | 14 ++++++ Makefile | 6 +++ Procfile.dev | 1 + app/controllers/admin/events_controller.rb | 34 +++++++++++++- app/jobs/score_scrape_job.rb | 31 ++++++++++++ app/models/concerns/golfer_name_matcher.rb | 12 ++++- app/models/event.rb | 14 ++++++ app/models/scrape.rb | 2 +- app/services/event_scraping_service.rb | 77 ++++++++++++++++++++++++++++++ app/services/tournament_scraper_service.rb | 30 ++----------- app/views/admin/events/_activity_feed.html.erb | 3 ++ .../admin/events/_score_updater_card.html.erb | 79 ++++++++++++++++++++++++++++++- config/application.rb | 4 +- config/environments/production.rb | 4 +- config/queue.yml | 3 ++ config/recurring.yml | 9 +++- config/routes.rb | 3 ++ .../260410162305_add_scraping_control_to_events.rb | 9 ++++ .../0260410162321_make_scrapes_user_id_nullable.rb | 9 ++++ db/schema.rb | 7 ++- docker-compose.production.yml | 34 +++++++++++++ lib/tasks/scraping.rake | 14 ++++++ 23 files changed, 358 insertions(+), 43 deletions(-)