Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Files

Latest commit

0225526 · Nov 14, 2021

History

History

cron

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 8, 2019
Mar 19, 2019
Oct 18, 2019
Nov 14, 2021

origin-cron

A framework for scheduling recurring jobs, based on the Bull queueing system and Redis. Each job runs as a separate process.

Adding a new job

Steps:

  • Implement the job logic in a new file under src/jobs.
  • Schedule the job by adding a queue and defining the job scheduler under src/scheduler.js

Important notes

  • Jobs should be idempotent since the framework only provides at least once guarantees. For more details, read Bull's documentation.

Running in local environment

  • Install Redis locally
  • Start the scheduler:
lerna bootstrap --scope origin-cron
lerna run start --scope origin-cron --stream

TODO

  • Currently all jobs run on the same node. Consider adding clustering.
  • Bring up a UI for making it easier to inspect the state of the system. Arena could be a good choice. We would have to figure how to make that data only accessible to Origin team members. kubectl port-forward could be a simple solution for this.