Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/zeroconf/_services/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ def reschedule_type(self, type_: str_, next_time: float_) -> bool:
self._next_time[type_] = next_time
return True

def _force_reschedule_type(self, type_: str_, next_time: float_) -> None:
"""Force a reschedule of a type."""
self._next_time[type_] = next_time

def process_ready_types(self, now: float_) -> List[str]:
"""Generate a list of ready types that is due and schedule the next time."""
if self.millis_to_wait(now):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):
now = _new_current_time_millis()
# Force the next query to be sent since we are testing
# to see if the query contains answers and not the scheduler
browser.query_scheduler._next_time[type_] = now + (1000 * expected_ttl)
browser.query_scheduler._force_reschedule_type(type_, now + (1000 * expected_ttl))
browser.reschedule_type(type_, now, now)
sleep_count += 1
await asyncio.wait_for(got_query.wait(), 1)
Expand Down Expand Up @@ -1350,7 +1350,7 @@ def _new_current_time_millis():
await asyncio.wait_for(service_added.wait(), 1)
time_offset = 1000 * expected_ttl # set the time to the end of the ttl
now = _new_current_time_millis()
browser.query_scheduler._next_time[type_] = now + (1000 * expected_ttl)
browser.query_scheduler._force_reschedule_type(type_, now + (1000 * expected_ttl))
# Make sure the query schedule is to a time in the future
# so we will reschedule
with patch.object(
Expand Down