state: GetSnapshot copies the state's maps (closes #261)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The dashboard and /api/v1/status range over the maps in the snapshot GetSnapshot returns after the read lock is released, while the watcher writes the same maps under the lock. Go aborts the process when a write lands during such a range. GetSnapshot now returns copies of the four maps. The entries in the maps are still shared with the state. That is safe because the watcher replaces an entry with a Set call and never changes one in place; the comment on GetSnapshot says so. TestGetSnapshot_WhileWritten ranges over snapshots while another goroutine writes the state and fails under -race without the copies. TestGetSnapshot_ReturnsCopy now checks that each map is not the state's own. Model: opus-5-5
This commit was merged in pull request #272.
This commit is contained in:
@@ -19,6 +19,8 @@ trial run of the finished image: https://git.eeqj.de/sneak/dnswatcher/issues/149
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-13: a check saving the state while the dashboard or `/api/v1/status`
|
||||
is read cannot crash the process (closes #261).
|
||||
- 2026-10-06: canonical files re-fetched from `sneak/prompts` at `dd4027b`; lint
|
||||
and test are phases of the `Dockerfile`, every scripted build uncached (closes
|
||||
#257).
|
||||
|
||||
Reference in New Issue
Block a user