mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Workaround for test failure: RuntimeError: There is no current event loop (#1803)
* Remove ensure_eventloop hack * Hack to recover from intermittent RuntimeError calling asyncio.Lock()
This commit is contained in:
parent
1c29b925d3
commit
64288d827f
2 changed files with 19 additions and 18 deletions
|
|
@ -231,7 +231,15 @@ class Datasette:
|
|||
self.inspect_data = inspect_data
|
||||
self.immutables = set(immutables or [])
|
||||
self.databases = collections.OrderedDict()
|
||||
self._refresh_schemas_lock = asyncio.Lock()
|
||||
try:
|
||||
self._refresh_schemas_lock = asyncio.Lock()
|
||||
except RuntimeError as rex:
|
||||
# Workaround for intermittent test failure, see:
|
||||
# https://github.com/simonw/datasette/issues/1802
|
||||
if "There is no current event loop in thread" in str(rex):
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
self._refresh_schemas_lock = asyncio.Lock()
|
||||
self.crossdb = crossdb
|
||||
self.nolock = nolock
|
||||
if memory or crossdb or not self.files:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue