mirror of
https://github.com/simonw/datasette.git
synced 2026-05-31 22:27:00 +02:00
Throttle schema refreshes to at most once per second, refs #2629
This commit is contained in:
parent
7915c46ddd
commit
7988a179fe
1 changed files with 4 additions and 0 deletions
|
|
@ -589,6 +589,10 @@ class Datasette:
|
|||
return None
|
||||
|
||||
async def refresh_schemas(self):
|
||||
# Throttle schema refreshes to at most once per second
|
||||
if time.monotonic() - getattr(self, "_last_schema_refresh", 0) < 1.0:
|
||||
return
|
||||
self._last_schema_refresh = time.monotonic()
|
||||
if self._refresh_schemas_lock.locked():
|
||||
return
|
||||
async with self._refresh_schemas_lock:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue