Skip to content

0.0.13b7

Pre-release
Pre-release

Choose a tag to compare

@dmoo500 dmoo500 released this 06 Apr 16:00

Fix race condition between reset_statistics and an in-progress sync

Problem: If a sync was mid-flight (suspended at an internal await, e.g. waiting for HTTP response), the reset could clear last_import = None — but then the sync would resume and call set_last_import(today), overwriting the reset. The next poll would then only import recent data instead of the full history.

Fix: Added an asyncio.Lock (_reset_lock) on the coordinator:

  • Every _async_update_data call acquires the lock for its entire duration
  • The reset handler acquires the same lock before clearing state

This guarantees: if a sync is running, reset waits for it to finish cleanly before clearing state. If reset is running, new syncs wait until reset (including state clear) is fully complete.