Skip to content

Comments

Have SaveRaceJob inherit from ActiveJob::Base and remove ApplicationJob#86

Open
maxmetcalfe wants to merge 1 commit intoversion-updatesfrom
codex/improve-save-race-performance
Open

Have SaveRaceJob inherit from ActiveJob::Base and remove ApplicationJob#86
maxmetcalfe wants to merge 1 commit intoversion-updatesfrom
codex/improve-save-race-performance

Conversation

@maxmetcalfe
Copy link
Owner

Motivation

  • Fix a production eager-load failure caused by relying on a missing ApplicationJob base class.
  • Ensure race-saving work runs asynchronously so controller requests do not block.
  • Keep the UI responsive by setting race state to FINISHED immediately before background processing.
  • Provide a simple in-process job backend for background execution.

Description

  • Deleted the unused app/jobs/application_job.rb base class and updated SaveRaceJob to inherit from ActiveJob::Base in app/jobs/save_race_job.rb.
  • Enqueued background work with SaveRaceJob.perform_later(race.id) and set the race state to FINISHED before redirecting in RacesController#save_race.
  • Added config.active_job.queue_adapter = :async to config/application.rb to enable an in-process job adapter for simple background execution.
  • SaveRaceJob computes race_count, fav_bib, and updates streak calendars for affected Racer records in the background.

Testing

  • No automated tests were run for these changes.
  • Manual verification steps were not recorded as part of this PR.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant