Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crazyoptimist/distributed-background-jobs-asynq
Distributed Background Task Handling with Asynq Go
https://github.com/crazyoptimist/distributed-background-jobs-asynq
Last synced: 13 days ago
JSON representation
Distributed Background Task Handling with Asynq Go
- Host: GitHub
- URL: https://github.com/crazyoptimist/distributed-background-jobs-asynq
- Owner: crazyoptimist
- Created: 2024-02-26T00:33:02.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-02-26T07:17:17.000Z (8 months ago)
- Last Synced: 2024-10-03T21:41:14.474Z (about 1 month ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Distributed Background Jobs with Asynq
This applicaton demonstrates distributed background jobs handling with [asynq](https://github.com/hibiken/asynq).
Asynq is very impressive and easy to use. It ensures a task to be run at least once and only once.
## Instructions for Demo
Create an env file.
```bash
cp ./deployments/.env.example ./deployments/.env
```Run the app with docker.
```bash
make docker
make upd
make log
```Request bunch of (virtual)heavy tasks via exposed API.
```bash
for i in {1..11}; do; echo $i:; http http://localhost:8080/sleep seconds:=5; done;
```Then watch logs to see what's happening. Individual worker containers run tasks concurrently. Concurrency inside a worker has been disabled for demonstration purposes, which is configurable in the worker configuration code.
## Makefile
build docker images
```bash
make docker
```run with docker compose
```bash
make up
```run in detached mode
```bash
make upd
```docker compose log
```bash
make log
```docker compose down
```bash
make down
```run the test suite
```bash
make test
```