Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Integrate periodic tasks into ngweb service #19

Open
icook opened this issue Jan 1, 2018 · 0 comments
Open

Integrate periodic tasks into ngweb service #19

icook opened this issue Jan 1, 2018 · 0 comments

Comments

@icook
Copy link
Owner

icook commented Jan 1, 2018

Without too much trouble running of periodic tasks (updating block confirmation, crediting blocks, etc) could be built into ngweb service. Advantages:

  • Less configuration to setup pool. No need to setup crontabs, just run ngweb
  • Easy tracking of run information for debugging and uptime.
  • Strong assurance that two crontabs won't be run at same time and interleave in harmful or breaking ways. This shouldn't cause problems, but exhaustive testing hasn't been done to ensure that it doesn't.

General idea

  • Every periodic task has a row in SQL. Stores unique name of task, last run time, next run time, and run interval
  • A goroutine runs every 30 seconds. It selects all tasks where next run time < current time. Locks the rows to prevent interleaving of tasks between multiple ngweb instances.
  • Execute each task, record output, insert into a table of task run information.
  • Add API endpoint for viewing task run information.
  • Add status API endpoint for checking/alerting about errors.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant