mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Include database in name of _execute_writes thread, closes #2265
This commit is contained in:
parent
bd9ed62e5d
commit
398a92cf1e
2 changed files with 8 additions and 1 deletions
|
|
@ -196,6 +196,9 @@ class Database:
|
||||||
self._write_thread = threading.Thread(
|
self._write_thread = threading.Thread(
|
||||||
target=self._execute_writes, daemon=True
|
target=self._execute_writes, daemon=True
|
||||||
)
|
)
|
||||||
|
self._write_thread.name = "_execute_writes for database {}".format(
|
||||||
|
self.name
|
||||||
|
)
|
||||||
self._write_thread.start()
|
self._write_thread.start()
|
||||||
task_id = uuid.uuid5(uuid.NAMESPACE_DNS, "datasette.io")
|
task_id = uuid.uuid5(uuid.NAMESPACE_DNS, "datasette.io")
|
||||||
reply_queue = janus.Queue()
|
reply_queue = janus.Queue()
|
||||||
|
|
|
||||||
|
|
@ -780,7 +780,11 @@ async def test_threads_json(ds_client):
|
||||||
expected_keys = {"threads", "num_threads"}
|
expected_keys = {"threads", "num_threads"}
|
||||||
if sys.version_info >= (3, 7, 0):
|
if sys.version_info >= (3, 7, 0):
|
||||||
expected_keys.update({"tasks", "num_tasks"})
|
expected_keys.update({"tasks", "num_tasks"})
|
||||||
assert set(response.json().keys()) == expected_keys
|
data = response.json()
|
||||||
|
assert set(data.keys()) == expected_keys
|
||||||
|
# Should be at least one _execute_writes thread for __INTERNAL__
|
||||||
|
thread_names = [thread["name"] for thread in data["threads"]]
|
||||||
|
assert "_execute_writes for database __INTERNAL__" in thread_names
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue