mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Added /-/threads debugging page
This commit is contained in:
parent
855c7ed851
commit
7c247be4c9
2 changed files with 38 additions and 0 deletions
|
|
@ -457,6 +457,15 @@ class Datasette:
|
|||
for p in ps
|
||||
]
|
||||
|
||||
def threads(self):
|
||||
threads = list(threading.enumerate())
|
||||
return {
|
||||
"num_threads": len(threads),
|
||||
"threads": [
|
||||
{"name": t.name, "ident": t.ident, "daemon": t.daemon} for t in threads
|
||||
],
|
||||
}
|
||||
|
||||
def table_metadata(self, database, table):
|
||||
"Fetch table-specific metadata."
|
||||
return (
|
||||
|
|
@ -621,6 +630,10 @@ class Datasette:
|
|||
JsonDataView.as_asgi(self, "config.json", lambda: self._config),
|
||||
r"/-/config(?P<as_format>(\.json)?)$",
|
||||
)
|
||||
add_route(
|
||||
JsonDataView.as_asgi(self, "threads.json", self.threads),
|
||||
r"/-/threads(?P<as_format>(\.json)?)$",
|
||||
)
|
||||
add_route(
|
||||
JsonDataView.as_asgi(self, "databases.json", self.connected_databases),
|
||||
r"/-/databases(?P<as_format>(\.json)?)$",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue