You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Its sub-optimal because we will schedule a query in the future when a PTR will be close to expiring, but if the PTR is seen again between when it was scheduled and we ask again, we still ask.
In #818 the scheduler was abstracted into QueryScheduler so it should be easier to improve it now.
One strategy would be that instead of change of the next time, schedule a check to see if we should do another query by checking everything in the cache to see if a refresh is due for that service and then bump the next time if so.
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):
return []
ready_types: List[str] = []
for type_, due in self._next_time.items():
if due > now:
continue
ready_types.append(type_)
self._next_time[type_] = now + self._delay[type_]
self._delay[type_] = min(_BROWSER_BACKOFF_LIMIT * 1000, self._delay[type_] * 2)
return ready_types
If it becomes due process_ready_types could recalculate the lowest of all the record.get_expiration_time(_EXPIRE_REFRESH_TIME_PERCENT) for that type in the cache and if its not now, reschedule self._next_time for the type for than but don't update delay
Activity
bdraco commentedon Jul 15, 2021
One strategy would be that instead of change of the next time, schedule a check to see if we should do another query by checking everything in the cache to see if a refresh is due for that service and then bump the next time if so.
feat: improve performance of ServiceBrowser outgoing query scheduler
bdraco commentedon May 4, 2023
This is still a problem
bdraco commentedon May 4, 2023
If it becomes due
process_ready_typescould recalculate the lowest of all therecord.get_expiration_time(_EXPIRE_REFRESH_TIME_PERCENT)for that type in the cache and if its not now, rescheduleself._next_timefor the type for than but don't update delayfix: avoid querying to refresh types in the ServiceBrowser when they …
bdraco commentedon Dec 14, 2023
It might make sense to implement lower on all of these and put everything in a heap queue
bdraco commentedon Dec 14, 2023
We probably need another object to track on so when its removed, we can mark it removed , and keep track of it like timer handler canceled
We will need to pop all the ready ones at at once.
bdraco commentedon Dec 14, 2023
We likely generate an order of magnitude more queries than we should when a service browser is running.
We should do 3x to get it primed, and than only query to rescue records when they are at the top of the heap
feat: significantly improve efficiency of the ServiceBrowser scheduler
feat: significantly improve efficiency of the ServiceBrowser scheduler
Bump zeroconf to 0.130.0