Grelmicro is a lightweight framework/toolkit which is ideal for building async microservices in Python.
https://grelmicro.grel.info/ โ HEALTH ? 97 / Healthy
Grelmicro is a lightweight framework/toolkit which is ideal for building async microservices in Python.
https://grelmicro.grel.info/ โ// readme
Run a second copy of your app and things break quietly. The cron job runs twice. The rate limit lets through twice the traffic. One replica keeps calling a dead service the other already gave up on.
grelmicro fixes that with one line that says where shared state lives: Redis, Valkey, PostgreSQL or SQLite. Works with FastAPI, Starlette, Litestar and FastStream. Python 3.14+.
pip install "grelmicro[fastapi,redis]"
Documentation: https://grelmicro.grel.info/
Source Code: https://github.com/grelinfo/grelmicro
Run a job once a minute across all your replicas, not once per replica. Create a file main.py with:
from fastapi import FastAPI
from grelmicro import Grelmicro
from grelmicro.providers.redis import RedisProvider
from grelmicro.task import Tasks
app = FastAPI()
tasks = Tasks()
micro = Grelmicro(uses=[RedisProvider("redis://localhost:6379/0"), tasks])
micro.install(app)
@tasks.every(interval=60,โฆ