Pulse/internal/utils
rcourtman 6f2b6268a4 perf: optimize mock mode state retrieval and JSON encoding
Improve performance when serving /api/state in mock mode by optimizing
alert handling and JSON serialization.

Changes:
- Add UpdateAlertSnapshots() to cache alerts without blocking
- Use lazy population of alert snapshots to avoid lock contention
- Switch to json.Marshal for better performance with large payloads
- Add debug logging to track /api/state performance
- Simplify GetState() logic in mock mode

Performance improvements:
- Eliminates alert manager lock during /api/state requests
- Reduces JSON encoding overhead for large mock datasets
- Ensures sub-second response times even with 7 nodes and 90+ guests

Testing:
- Mock mode returns state instantly without blocking
- Alert snapshots populate correctly on first request
- Debug logs confirm fast execution path
2025-10-01 13:35:49 +00:00
..
command.go chore: tidy repo formatting and linting 2025-09-29 20:19:18 +00:00
generics.go chore: tidy repo formatting and linting 2025-09-29 20:19:18 +00:00
helpers.go perf: optimize mock mode state retrieval and JSON encoding 2025-10-01 13:35:49 +00:00
network.go chore: tidy repo formatting and linting 2025-09-29 20:19:18 +00:00
paths.go chore: tidy repo formatting and linting 2025-09-29 20:19:18 +00:00
ratelimiter.go chore: tidy repo formatting and linting 2025-09-29 20:19:18 +00:00