feat(backend): webhooks deliver signed alerts from an outbox with retries and a test send
This commit is contained in:
1 parent
2bb8ca45fb
commit
9da0c06ac1
8 files changed
+502
No files matched your search
@@ -38,7 +38,9 @@ from api.routers import (
|
||||
storage,
|
||||
stories,
|
||||
watches,
|
||||
webhooks,
|
||||
)
|
||||
from api.webhooks import outbox
|
||||
from dependencies.container import container
|
||||
from utils.cache import DAY_HEADERS, IMMUTABLE_HEADERS, NO_STORE_HEADERS
|
||||
from utils.env import env
|
||||
@@ -58,11 +60,14 @@ mcp_app = mcp.http_app(path="/")
|
||||
@asynccontextmanager
|
||||
async def lifespan(app_: Starlette) -> AsyncGenerator[None]:
|
||||
pool = await container.get(asyncpg.Pool)
|
||||
hub.alert_listeners.append(outbox.wake)
|
||||
await hub.start(pool)
|
||||
purger = asyncio.create_task(
|
||||
purge_loop(pool, await container.get(ContentAddressedStorage))
|
||||
)
|
||||
deliverer = asyncio.create_task(outbox.run(pool))
|
||||
yield
|
||||
deliverer.cancel()
|
||||
purger.cancel()
|
||||
await hub.stop()
|
||||
await app_.state.dishka_container.close()
|
||||
@@ -103,6 +108,7 @@ app.include_router(peers.router)
|
||||
app.include_router(discover.router)
|
||||
app.include_router(annotations.router)
|
||||
app.include_router(watches.router)
|
||||
app.include_router(webhooks.router)
|
||||
app.include_router(shares.router)
|
||||
app.include_router(storage.router)
|
||||
app.include_router(files.router)
|
||||
|
||||
Reference in new issue
Block a user