make sure long running operations don't ruin monitor performances

parent 56169ca9
Pipeline #1649 passed with stages
in 9 minutes and 30 seconds
......@@ -15,6 +15,7 @@ import struct
import logging
import datetime
from functools import partial
from itertools import count
from async_generator import asynccontextmanager
......@@ -225,7 +226,8 @@ class MonitorPool:
response = self._status_cache[query]
async with self.get_mon(ident) as mon:
response = mon.status(query, timeout=self.timeout, cache=False, raw=True)
wrap = partial(mon.status, query, timeout=self.timeout, cache=False, raw=True)
response = await trio.run_sync_in_worker_thread(wrap)
if cache:
self._status_cache[query] = response
......@@ -271,7 +273,7 @@ class MonitorPool:
mon = Monitor(self.burpbin, self.bconfcli, timeout=self.timeout, ident=id)
# warm up monitor
await trio.run_sync_in_worker_thread(mon.status)
await self.pool.put(mon)
except (BUIserverException, OSError):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment