Skip to content

Instantly share code, notes, and snippets.

@hennevogel
Last active July 14, 2017 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hennevogel/e776bfe4def12909b6b750fc968a3061 to your computer and use it in GitHub Desktop.
Save hennevogel/e776bfe4def12909b6b750fc968a3061 to your computer and use it in GitHub Desktop.
  • Approach A: Remove Events table, every time something happens schedule a mulitpurpose job.
  • Approach B: Remove Events table, every time something happens schedule multiple single purpose jobs.
. Both solutions Approach A Approach B
Pro No No duplication of event data. Makes the events table redundant - we can easily get rid of the table and use the Event classes as POROs
Pro Failures and retries can be handled by delayed job. . No need to check when events can be deleted
Pro Failed jobs can be re-run manually . No hacking of delayed job gem required
Pro Individual queues would not be necessary . .
. . . .
Con This will create many more delayed_jobs than we currently have - could run into scaling problems (though concurrency might help this) Needs a cron job to delete events whose jobs have all completed Event data will be duplicated several times in the delayed_jobs table. Parallel processing may help keep the size of delayed_jobs table down.
Con . Event_id index on delayed_jobs could make it slower .
Con . Requires significant hacking of the delayed_job gem which could be difficult or switching to a different background process gem .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment