Skip to content

freundallein/scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scheduler

Description

Provides ability to manage background tasks with delay.

You set a task with any payload and can poll it state until completion.

In the same time, worker will claim this task, try to process it and push results back to the service.

API

Service implements JSON-RPC 2.0 and contains 2 types of API:

  • scheduler (public) used for setting a task;
  • worker (private) for processing a task.

Do you want to know more?

Design

Alt text

SLA

...

Deployment

Service uses environment variables for configuration.

Most important parameter is DB_DSN - address of a postgres instance.

You can see a full list of parameters in Makefile.

Docker

To get image run
docker pull ghcr.io/freundallein/scheduler:latest

Docker-compose example

Build

You can build scheduler via Makefile:

make build

Binary file will be delivered to ./bin/scheduler.

Example

For proper work you will need a client and a worker.

You can run example with client and worker via Makefile:

make run
make example

Ensure, that you change variables in Makefile, especially DB_DSN

Example code

Load test

...

TODO

  • extend unittests
  • add grafana dashboard
  • add prolong operation for worker
  • benchmarks
  • fill README.md