File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ developer = [
5353 " pytest" , # Test code functionality
5454]
5555instrument-server = [
56+ " aiohttp" ,
5657 " fastapi[standard]" ,
5758 " python-jose[cryptography]" ,
5859 " uvicorn[standard]" ,
Original file line number Diff line number Diff line change 99from typing import Dict , List , Optional
1010from urllib .parse import urlparse
1111
12+ import aiohttp
1213import requests
1314
1415import murfey .client .websocket
@@ -101,7 +102,7 @@ def _multigrid_watcher_finalised(self):
101102 self .multigrid_watcher_active = False
102103 self .dormancy_check ()
103104
104- def dormancy_check (self ):
105+ async def dormancy_check (self ):
105106 if not self .multigrid_watcher_active :
106107 if (
107108 all (r ._finalised for r in self .rsync_processes .values ())
@@ -110,6 +111,14 @@ def dormancy_check(self):
110111 w .thread .is_alive () for w in self ._environment .watchers .values ()
111112 )
112113 ):
114+ async with aiohttp .ClientSession () as clientsession :
115+ async with clientsession .delete (
116+ f"{ self ._environment .url .geturl ()} /sessions/{ self .session_id } " ,
117+ json = {"access_token" : self .token , "token_type" : "bearer" },
118+ ) as response :
119+ success = response .status == 200
120+ if not success :
121+ log .warning (f"Could not delete database data for { self .session_id } " )
113122 self .dormant = True
114123
115124 def finalise (self ):
Original file line number Diff line number Diff line change @@ -147,10 +147,6 @@ def start_multigrid_watcher(
147147 for sid , controller in controllers .items ():
148148 if controller .dormant :
149149 del controllers [sid ]
150- requests .delete (
151- f"{ _get_murfey_url ()} /sessions/{ sanitise_nonpath (str (sid ))} " ,
152- headers = {"Authorization" : f"Bearer { tokens [sid ]} " },
153- )
154150 controllers [session_id ] = MultigridController (
155151 [],
156152 watcher_spec .visit ,
You can’t perform that action at this time.
0 commit comments