config::WriteRateLimiter

Newest-wins write coalescing with a trailing flush.

Declared in src/libs/libconfig/config/WriteRateLimiter.hpp
Inherits QObject

Detailed description

A dragged control would write its store once per mouse move. For a document level each write re-serializes the scene, so the limiter keeps only the newest value per key and writes it at most once per interval.

The contract, per key:

  • Only the newest pending value survives.
  • Idle, or past the window: write straight through, so a single click lands at once.
  • Inside the window: arm a single-shot trailing flush, so the value the operator stops on is written even though it arrived mid-window.

The clock is injectable and flush() is public, so a test drives a whole drag and asserts the count of writes, not the timing. Lifted from Construct (config-ui §CFGS-1), with the discard made per key.