Skip to content

Conversation

@hellais
Copy link
Member

@hellais hellais commented Jan 30, 2026

Implements: #910

@hellais hellais changed the title Rate limiter Rate limiter support in ooniservices Jan 30, 2026
@aagbsn
Copy link
Contributor

aagbsn commented Jan 31, 2026

It looks like the tests hey it looks like tests/run fail with this error:

(.hatchenv) 179d1346c7d2:/project/ooni/backend/ooniapi/services/oonimeasurements$ make run
hatch run uvicorn oonimeasurements.main:app
INFO:     Started server process [5211]
INFO:     Waiting for application startup.
ERROR:    Traceback (most recent call last):
  File "/project/ooni/backend/ooniapi/services/oonimeasurements/.venv/lib/python3.12/site-packages/starlette/routing.py", line 705, in lifespan
    async with self.lifespan_context(app) as maybe_state:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/project/ooni/backend/ooniapi/services/oonimeasurements/src/oonimeasurements/main.py", line 34, in lifespan
    app.add_middleware(RateLimiterMiddleware, redis_url=settings.redis_url)
  File "/project/ooni/backend/ooniapi/services/oonimeasurements/.venv/lib/python3.12/site-packages/starlette/applications.py", line 129, in add_middleware
    raise RuntimeError("Cannot add middleware after an application has started")
RuntimeError: Cannot add middleware after an application has started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants