You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7c9a3bc
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: replace wall-clock time with monotonic nanoseconds for request eviction
- Add `created` timestamp to Jaws struct and capture it in New()
- Introduce nowNano() method returning monotonic elapsed nanoseconds since creation
- Update oldestEvictablePendingLocked to use nowNano instead of time.Time, and check lastWriteNano against 2*maintenanceInterval window
- Replace all time.Now() calls with jw.nowNano() in pending eviction and maintenance logic
- Switch from Rendering flag + lastWrite time comparison to direct lastWriteNano recency check
- Update tests to simulate writes via MarkWritten instead of setting Rendering flag
- Add BenchmarkRequestMarkWritten for write stamping performance tracking
Signed-off-by: Johan Lindh <johan@linkdata.se>
Copy file name to clipboardExpand all lines: jaws.go
+44-38Lines changed: 44 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -155,6 +155,7 @@ type Jaws struct {
155
155
MaxPendingRequestsPerIPint// Maximum number of unclaimed Requests per client IP. Defaults to DefaultMaxPendingRequestsPerIP. Set <=0 to disable the cap.
156
156
webSocketTimeout time.Duration// timeout duration passed to ServeWith
157
157
maintenanceInterval time.Duration// Serve maintenance tick interval; set by ServeWithTimeout and read under mu, zero until Serve starts
158
+
created time.Time// monotonic base captured in New(); read-only after construction, basis for nowNano
0 commit comments