Refactor noise floor retrieval in RepeaterHandler to use asyncio executor

- Updated the noise floor retrieval method to run in an executor, preventing blocking of the event loop during the KISS modem's command execution.
- This change enhances responsiveness by allowing the process to handle other tasks while waiting for the noise floor measurement.
This commit is contained in:
agessaman
2026-02-21 08:19:00 -08:00
parent 65164fffb7
commit e14fd3feea

View File

@@ -874,7 +874,10 @@ class RepeaterHandler(BaseHandler):
return
try:
noise_floor = self.get_noise_floor()
# Run in executor so KISS modem's blocking _send_command (up to 5s timeout)
# does not block the event loop and hang the process / delay Ctrl+C.
loop = asyncio.get_running_loop()
noise_floor = await loop.run_in_executor(None, self.get_noise_floor)
if noise_floor is not None:
self.storage.record_noise_floor(noise_floor)
logger.debug(f"Recorded noise floor: {noise_floor} dBm")