html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app https://github.com/simonw/datasette/issues/1802#issuecomment-1237545794,https://api.github.com/repos/simonw/datasette/issues/1802,1237545794,IC_kwDOBm6k_c5Jw3NC,9599,2022-09-06T00:31:31Z,2022-09-06T00:31:31Z,OWNER,"Well I'm not proud of it, but that did seem to do the trick!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1362402998, https://github.com/simonw/datasette/issues/1802#issuecomment-1237542803,https://api.github.com/repos/simonw/datasette/issues/1802,1237542803,IC_kwDOBm6k_c5Jw2eT,9599,2022-09-06T00:23:27Z,2022-09-06T00:23:27Z,OWNER,"Trying this fix: ```diff diff --git a/datasette/app.py b/datasette/app.py index f2a6763a5..b17888a07 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -231,7 +231,13 @@ def __init__( 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: + 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: ``` This is mainly superstition at this point! I found that recipe on https://techoverflow.net/2020/10/01/how-to-fix-python-asyncio-runtimeerror-there-is-no-current-event-loop-in-thread/","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1362402998, https://github.com/simonw/datasette/issues/1802#issuecomment-1237542508,https://api.github.com/repos/simonw/datasette/issues/1802,1237542508,IC_kwDOBm6k_c5Jw2Zs,9599,2022-09-06T00:22:37Z,2022-09-06T00:22:37Z,OWNER,"The code that I control that shows up in the trace is this: https://github.com/simonw/datasette/blob/fd1086c6867f3e3582b1eca456e4ea95f6cecf8b/datasette/app.py#L234","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1362402998, https://github.com/simonw/datasette/issues/1802#issuecomment-1237540231,https://api.github.com/repos/simonw/datasette/issues/1802,1237540231,IC_kwDOBm6k_c5Jw12H,9599,2022-09-06T00:16:10Z,2022-09-06T00:16:10Z,OWNER,Removing the `ensure_eventloop()` hack produced the exact same test failure: https://github.com/simonw/datasette/runs/8197570109?check_suite_focus=true,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1362402998, https://github.com/simonw/datasette/issues/1802#issuecomment-1237537205,https://api.github.com/repos/simonw/datasette/issues/1802,1237537205,IC_kwDOBm6k_c5Jw1G1,9599,2022-09-06T00:08:03Z,2022-09-06T00:08:46Z,OWNER,"I'm suspicious that this hack here may be hurting me: https://github.com/simonw/datasette/blob/b91e17280c05bbb9cf97432081bdcea8665879f9/tests/test_cli.py#L25-L29 I added that two years ago in https://github.com/simonw/datasette/commit/3159263f05ac4baf968929d59384d9223a539071","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1362402998,