search for standard sites pub-search.waow.tech
search zig blog atproto
11
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: load timing data on getStats/getTimeSeries, not just record

previously timing data was only loaded from disk when record() was
called. if the first request after restart was to /api/dashboard,
the timing data would appear empty.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

zzstoatzz cf3a5dd0 88441f0e

+13 -5
+13 -5
backend/src/timing.zig
··· 97 97 mutex.lock(); 98 98 defer mutex.unlock(); 99 99 100 - if (!initialized) { 101 - initialized = true; 102 - loadLocked(); 103 - loadHourlyLocked(); 104 - } 100 + ensureInitialized(); 105 101 106 102 const ep_idx = @intFromEnum(endpoint); 107 103 buffers[ep_idx].record(elapsed_us); ··· 181 177 } 182 178 } 183 179 180 + fn ensureInitialized() void { 181 + if (!initialized) { 182 + initialized = true; 183 + loadLocked(); 184 + loadHourlyLocked(); 185 + } 186 + } 187 + 184 188 /// get stats for a specific endpoint 185 189 pub fn getStats(endpoint: Endpoint) EndpointStats { 186 190 mutex.lock(); 187 191 defer mutex.unlock(); 192 + 193 + ensureInitialized(); 188 194 189 195 const buf = &buffers[@intFromEnum(endpoint)]; 190 196 if (buf.count == 0) return .{}; ··· 221 227 pub fn getTimeSeries(endpoint: Endpoint) [HOURS_TO_KEEP]TimeSeriesPoint { 222 228 mutex.lock(); 223 229 defer mutex.unlock(); 230 + 231 + ensureInitialized(); 224 232 225 233 const current_hour = getCurrentHour(); 226 234 const ep_buckets = hourly[@intFromEnum(endpoint)];