The Fix
Upgrade to version 0.22.0 or later.
Based on closed Kludex/uvicorn issue #1832 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -82,6 +82,8 @@ def __init__(
def should_restart(self) -> Optional[List[Path]]:
+ self.pause()
+
changes = next(self.watcher)
import sys
import logging
import uvicorn
from fastapi import FastAPI
app = FastAPI()
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
stream=sys.stdout,
)
logger = logging.getLogger('uvicorn')
LOG_CONFIG = {
'version': 1,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'generic',
}
},
'formatters': {
'generic': {
'format': '%(asctime)s [%(process)d] [%(levelname)s] %(message)s',
'datefmt': '[%Y-%m-%d %H:%M:%S]',
'class': 'logging.Formatter',
}
},
'loggers': {
'uvicorn': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
},
}
}
@app.get('/')
def read_root():
return {'Hello': 'World'}
if __name__ == '__main__':
uvicorn.run(
'__main__:app',
host='0.0.0.0',
port=8000,
reload=True,
reload_delay=120.0,
log_config=LOG_CONFIG
)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 0.22.0 or later.\nWhen NOT to use: This fix should not be used if the reload behavior is intended to be immediate.\n\n
Why This Fix Works in Production
- Trigger: If I understand correctly, `uvicorn` should reload after 120s of file changes, but actually `uvicorn` seems to start reloading right away. (I can't tell if…
- Mechanism: The WatchFilesReload class does not respect the reload_delay setting due to missing pause functionality
- Why the fix works: Adds a pause method to the WatchFilesReload class, addressing the issue with the reload_delay setting not being respected. (first fixed release: 0.22.0).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- The WatchFilesReload class does not respect the reload_delay setting due to missing pause functionality
- Production symptom (often without a traceback): If I understand correctly, `uvicorn` should reload after 120s of file changes, but actually `uvicorn` seems to start reloading right away. (I can't tell if it's immediately or the default 0.25s)
Proof / Evidence
- GitHub issue: #1832
- Fix PR: https://github.com/kludex/uvicorn/pull/1930
- First fixed release: 0.22.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.45
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“I have taken a look into this issue and went through watchfiles docs and code”
“sorry not to reply earlier. My instinct is that this is an oversight. The closest equivilant to reload_delay in watchfiles is debounce I think, see…”
“@samuelcolvin do you remember if this was on purpose?”
“That is my understanding as well - watchfiles does not use the reload_delay setting”
Failure Signature (Search String)
- If I understand correctly, `uvicorn` should reload after 120s of file changes, but actually `uvicorn` seems to start reloading right away. (I can't tell if it's immediately or the
- [2023-01-05 05:03:08] [24864] [INFO] Will watch for changes in these directories: ['D:\\code\\test']
Copy-friendly signature
Failure Signature
-----------------
If I understand correctly, `uvicorn` should reload after 120s of file changes, but actually `uvicorn` seems to start reloading right away. (I can't tell if it's immediately or the default 0.25s)
[2023-01-05 05:03:08] [24864] [INFO] Will watch for changes in these directories: ['D:\\code\\test']
Error Message
Signature-only (no traceback captured)
Error Message
-------------
If I understand correctly, `uvicorn` should reload after 120s of file changes, but actually `uvicorn` seems to start reloading right away. (I can't tell if it's immediately or the default 0.25s)
[2023-01-05 05:03:08] [24864] [INFO] Will watch for changes in these directories: ['D:\\code\\test']
Minimal Reproduction
import sys
import logging
import uvicorn
from fastapi import FastAPI
app = FastAPI()
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
stream=sys.stdout,
)
logger = logging.getLogger('uvicorn')
LOG_CONFIG = {
'version': 1,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'generic',
}
},
'formatters': {
'generic': {
'format': '%(asctime)s [%(process)d] [%(levelname)s] %(message)s',
'datefmt': '[%Y-%m-%d %H:%M:%S]',
'class': 'logging.Formatter',
}
},
'loggers': {
'uvicorn': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
},
}
}
@app.get('/')
def read_root():
return {'Hello': 'World'}
if __name__ == '__main__':
uvicorn.run(
'__main__:app',
host='0.0.0.0',
port=8000,
reload=True,
reload_delay=120.0,
log_config=LOG_CONFIG
)
What Broke
Uvicorn reloads immediately instead of waiting for the specified reload_delay.
Why It Broke
The WatchFilesReload class does not respect the reload_delay setting due to missing pause functionality
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.22.0 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/kludex/uvicorn/pull/1930
First fixed release: 0.22.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the reload behavior is intended to be immediate.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.22.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.