Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/mountain_madness/_2026/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ def auto_save():
thread.start()

def increment(self, key: str, amount: int = 1) -> dict[str, int]:
"""Increment a counter by the given amount."""
"""Increment a counter by the given amount. Returns the current counters."""
with self._lock:
self._load_from_file_unlocked() # Always get latest from disk
self._counters[key] = self._counters.get(key, 0) + amount
self._maybe_save_unlocked()
self._save_to_file_unlocked()
return self._counters.copy()

def get(self, key: str) -> int:
Expand Down