Skip to content

Commit 1e4045a

Browse files
committed
Set min. amount of receiver queue to 30.
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent e58f012 commit 1e4045a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/frequenz/dispatch/_bg_service.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,14 @@ async def new_running_state_event_receiver(
178178
dispatch for dispatch in self._dispatches.values() if dispatch.type == type
179179
]
180180

181-
# Create receiver with enough capacity to hold all matching dispatches
181+
# Create a new receiver with at least 30 slots, but more if there are
182+
# more dispatches.
183+
# That way we can send all dispatches initially and don't have to worry
184+
# about the receiver being full.
185+
# If there are no initial dispatches, we still want to have some slots
186+
# available for future dispatches, so we set the limit to 30.
182187
receiver = self._running_state_status_channel.new_receiver(
183-
limit=max(1, len(dispatches))
188+
limit=max(30, len(dispatches))
184189
).filter(lambda dispatch: dispatch.type == type)
185190

186191
if merge_strategy:

0 commit comments

Comments
 (0)