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

Integrate periodic tasks into ngweb service #19

@icook

Description

@icook

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions