Repository navigation
dankmemer.py 1.0.1
Bug fix
Repeated global_boosts_changed events for boosts that haven't changed.
The API works out each global boost's endsAt per request, so identical boosts come back with end times a millisecond apart (…37.810Z vs …37.811Z). Because snapshots were compared exactly, global_boosts_changed fired on almost every poll and listeners posted the same boosts again and again.
Snapshot events (global boosts, drops, store sales, fishing events, daily gifts, lottery, merchant trades and the streaming game) now compare timestamps with a tolerance. A polled timestamp within the tolerance of its saved value keeps the saved value, so it isn't reported as a change. Slow drift is still measured from the saved value, so real changes are always reported.
New option
EventConfig.timestamp_tolerance (a timedelta, default 1 second, range 0 to 1 minute):
from datetime import timedelta
from dankmemer import DankMemer, EventConfig
dank = DankMemer(token, events=EventConfig(timestamp_tolerance=timedelta(seconds=1)))Set it to timedelta(0) to go back to exact comparison.
Upgrade notes
- No code changes are needed. The default fixes the duplicate events.
- Shared coordination: the tolerance is part of the shared settings check, so every process sharing a store must run 1.0.1 with the same tolerance.
Install
python -m pip install --upgrade "dankmemer.py>=1.0.1"
The dankmemer mirror package is published with the same version.