• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jstasiak / python-zeroconf / 887
94%

Build:
DEFAULT BRANCH: master
Ran 06 Sep 2020 07:01AM UTC
Jobs 6
Files 2
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
887

push

travis-ci

jstasiak
Avoid copying the entires cache and reduce frequency of Reaper

The cache reaper was running at least every 10 seconds, making
a copy of the cache, and iterated all the entries to
check if they were expired so they could be removed.

In practice the reaper was actually running much more frequently
because it used self.zc.wait which would unblock any time
a record was updated, a listener was added, or when a
listener was removed.

This change ensures the reaper frequency is only every 10s, and
will first attempt to iterate the cache before falling back to
making a copy.

Previously it made sense to expire the cache more frequently
because we had places were we frequently had to enumerate
all the cache entries. With #247 and #232 we no longer
have to account for this concern.

On a mostly idle RPi running HomeAssistant and a busy
network the total time spent reaping the cache was
more than the total time spent processing the mDNS traffic.

Top 10 functions, idle RPi (before)

  %Own   %Total  OwnTime  TotalTime  Function (filename:line)
  0.00%   0.00%    2.69s     2.69s   handle_read (zeroconf/__init__.py:1367)   <== Incoming mDNS
  0.00%   0.00%    1.51s     2.98s   run (zeroconf/__init__.py:1431)           <== Reaper
  0.00%   0.00%    1.42s     1.42s   is_expired (zeroconf/__init__.py:502)     <== Reaper
  0.00%   0.00%    1.12s     1.12s   entries (zeroconf/__init__.py:1274)       <== Reaper
  0.00%   0.00%   0.620s    0.620s   do_execute (sqlalchemy/engine/default.py:593)
  0.00%   0.00%   0.620s    0.620s   read_utf (zeroconf/__init__.py:837)
  0.00%   0.00%   0.610s    0.610s   do_commit (sqlalchemy/engine/default.py:546)
  0.00%   0.00%   0.540s     1.16s   read_name (zeroconf/__init__.py:853)
  0.00%   0.00%   0.380s    0.380s   do_close (sqlalchemy/engine/default.py:549)
  0.00%   0.00%   0.340s    0.340s   write (asyncio/selector_events.py:908)

After this change, the Reaper code paths do not show up in the top
10 function sample.

  %Own   ... (continued)

585 of 705 branches covered (82.98%)

2410 of 2584 relevant lines covered (93.27%)

5.6 hits per line

Jobs
ID Job ID Ran Files Coverage
1 887.1 06 Sep 2020 07:01AM UTC 0
93.28
Travis Job 887.1
2 887.2 06 Sep 2020 07:01AM UTC 0
93.28
Travis Job 887.2
3 887.3 06 Sep 2020 07:01AM UTC 0
93.28
Travis Job 887.3
4 887.4 06 Sep 2020 07:01AM UTC 0
93.28
Travis Job 887.4
5 887.5 06 Sep 2020 07:02AM UTC 0
93.28
Travis Job 887.5
6 887.6 06 Sep 2020 07:04AM UTC 0
93.2
Travis Job 887.6
Source Files on build 887
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #887
  • 1e4aaeaa on github
  • Prev Build on master (#868)
  • Next Build on master (#888)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc