Skip to content

Sensor import: the first flush sends no heartbeat while the monotonic clock reads under 30 s #768

Closed

Description

@LoopGlitch26

sensor.Import starts with self.beat = 0.0 and sends a heartbeat only when time.monotonic() - self.beat passes 30 s. So its first flush() sends none while the process's monotonic clock reads under 30 s.

Where it shows

  • On Linux, time.monotonic() counts from boot: an import started within 30 s of a node's boot (a DaemonSet on a fresh node, say) sends no heartbeat at first, so runs registered in that window aren't covered by one until the next.
  • On macOS with Python 3.9 the clock starts near 0 in each process, so pytest tests/test_sensor.py run on its own fails 11 tests on main; inside a longer pytest run it passes, which hides it.

A fix

Start beat as None, so the first flush() always sends a heartbeat, and keep the 30 s spacing after it. A regression test: an Import whose clock reads 5 s sends a heartbeat on its first flush.

Found while root-causing the intermittent test_sensor failure in #766.

Activity

  1. added a commit that references this issue on Nov 13, 2026
    6c62d83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions