Skip to content

Commit db7f11c

Browse files
committed
Define constant REPORT_QUEUE_FILLING_UP and set it to 8
1 parent 3ce1384 commit db7f11c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugwise_usb/connection/queue.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
_LOGGER = logging.getLogger(__name__)
1818

19+
REPORT_QUEUE_FILLING_UP: Final[int] = 8
1920

2021
@dataclass
2122
class RequestState:
@@ -144,10 +145,10 @@ async def _send_queue_worker(self) -> None:
144145
return
145146

146147
qsize = self._submit_queue.qsize()
147-
if qsize > 3:
148+
if qsize > REPORT_QUEUE_FILLING_UP:
148149
# When the queue size grows, rate-limit the sending of requests to avoid overloading the network
149150
await sleep(0.125)
150-
if qsize > 3:
151+
if qsize > REPORT_QUEUE_FILLING_UP:
151152
_LOGGER.warning("Awaiting plugwise responses %d", qsize)
152153

153154
await self._stick.write_to_stick(request)

0 commit comments

Comments
 (0)