PSKP-95 / scheduler

Scheduler can perform actions on cron expression. It uses postgres for storing schedules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scheduler

Scheduler can perform actions on cron expression. It uses postgres for storing schedules.

Architecture

The Scheduler App is a Go-based application that manages cronjobs stored in a PostgreSQL database. The application is designed with the following components:

APIs

The API layer is the interface through which clients interact with the Scheduler App. It exposes REST APIs that allow clients to create, read, update, and delete schedules. It also provides endpoints for querying the history of past occurrences.

Data

The data layer consists of the PostgreSQL database that stores the schedules, next_occurrence, and history tables. It is using sqlc for generating database related methods.

Worker

Worker is current running instance of app. It will register itself in database, will own work/schedule occurence, and it will hand over occurence to executor when occurence expire. It is also responsible to unown occurences from dead workers.

Worker's Life

Hooks system & Executor

The hooks system allows for custom actions to be taken when a occurence is expired. Hooks are Go functions that take a context. The context provides access to the necessary data for executing the hook.

Executor's Life

Main Flow

main flow

About

Scheduler can perform actions on cron expression. It uses postgres for storing schedules.

License:Apache License 2.0


Languages

Language:Go 56.4%Language:TypeScript 25.3%Language:HTML 10.6%Language:CSS 6.6%Language:Makefile 0.8%Language:Dockerfile 0.4%