Skip to content

Commit 0060f79

Browse files
authored
chore: fix more failing ServiceBrowser tests (#1295)
1 parent eba2e31 commit 0060f79

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/zeroconf/_services/browser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ def reschedule_type(self, type_: str_, next_time: float_) -> bool:
269269
self._next_time[type_] = next_time
270270
return True
271271

272+
def _force_reschedule_type(self, type_: str_, next_time: float_) -> None:
273+
"""Force a reschedule of a type."""
274+
self._next_time[type_] = next_time
275+
272276
def process_ready_types(self, now: float_) -> List[str]:
273277
"""Generate a list of ready types that is due and schedule the next time."""
274278
if self.millis_to_wait(now):

tests/test_asyncio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):
10551055
now = _new_current_time_millis()
10561056
# Force the next query to be sent since we are testing
10571057
# to see if the query contains answers and not the scheduler
1058-
browser.query_scheduler._next_time[type_] = now + (1000 * expected_ttl)
1058+
browser.query_scheduler._force_reschedule_type(type_, now + (1000 * expected_ttl))
10591059
browser.reschedule_type(type_, now, now)
10601060
sleep_count += 1
10611061
await asyncio.wait_for(got_query.wait(), 1)
@@ -1350,7 +1350,7 @@ def _new_current_time_millis():
13501350
await asyncio.wait_for(service_added.wait(), 1)
13511351
time_offset = 1000 * expected_ttl # set the time to the end of the ttl
13521352
now = _new_current_time_millis()
1353-
browser.query_scheduler._next_time[type_] = now + (1000 * expected_ttl)
1353+
browser.query_scheduler._force_reschedule_type(type_, now + (1000 * expected_ttl))
13541354
# Make sure the query schedule is to a time in the future
13551355
# so we will reschedule
13561356
with patch.object(

0 commit comments

Comments
 (0)