From 869c018a7a26285263cf7692f25f6aa44e2635c9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 26 Sep 2025 08:21:27 +0300 Subject: Bump version to 0.12.1 --- docs/coverage.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'docs/coverage.html') diff --git a/docs/coverage.html b/docs/coverage.html index 7cda0d1..36775ce 100644 --- a/docs/coverage.html +++ b/docs/coverage.html @@ -7269,9 +7269,9 @@ import ( "golang.org/x/sys/unix" ) -func tryLockFile(fd uintptr) error { - if err := unix.Flock(int(fd), unix.LOCK_EX|unix.LOCK_NB); err != nil { - if errors.Is(err, unix.EWOULDBLOCK) { +func tryLockFile(fd uintptr) error { + if err := unix.Flock(int(fd), unix.LOCK_EX|unix.LOCK_NB); err != nil { + if errors.Is(err, unix.EWOULDBLOCK) { return errLockWouldBlock } return err @@ -7315,14 +7315,14 @@ var windowSeconds int64 = int64(defaultWindow.Seconds()) var errLockWouldBlock = errors.New("stats: lock would block") // SetWindow sets the sliding window used for pruning and aggregation. -func SetWindow(d time.Duration) { +func SetWindow(d time.Duration) { if d < time.Second { d = time.Second } - if d > 24*time.Hour { + if d > 24*time.Hour { d = 24 * time.Hour } - atomic.StoreInt64(&windowSeconds, int64(d.Seconds())) + atomic.StoreInt64(&windowSeconds, int64(d.Seconds())) } // Window returns the current sliding window. @@ -7386,7 +7386,7 @@ func Update(ctx context.Context, provider, model string, sentBytes, recvBytes in if b, rerr := os.ReadFile(path); rerr == nil { _ = json.Unmarshal(b, &sf) } - if sf.Version != fileVersion { + if sf.Version != fileVersion { sf = File{Version: fileVersion} } now := time.Now() @@ -7439,18 +7439,18 @@ func Update(ctx context.Context, provider, model string, sentBytes, recvBytes in func acquireFileLock(ctx context.Context, f *os.File) (func() error, error) { fd := f.Fd() - for { + for { err := tryLockFile(fd) if err == nil { return func() error { return unlockFile(fd) }, nil } - if errors.Is(err, errLockWouldBlock) { + if errors.Is(err, errLockWouldBlock) { select { case <-ctx.Done(): return nil, ctx.Err() - case <-time.After(5 * time.Millisecond): + case <-time.After(5 * time.Millisecond): } - continue + continue } return nil, err } @@ -7482,18 +7482,18 @@ func TakeSnapshot() (Snapshot, error) { } cutoff := time.Now().Add(-win) snap := Snapshot{Providers: make(map[string]ProviderEntry), Window: win} - for _, ev := range sf.Events { + for _, ev := range sf.Events { if ev.TS.Before(cutoff) { continue } - snap.Global.Reqs++ + snap.Global.Reqs++ snap.Global.Sent += ev.Sent snap.Global.Recv += ev.Recv pe := snap.Providers[ev.Provider] if pe.Models == nil { pe.Models = make(map[string]Counters) } - pe.Totals.Reqs++ + pe.Totals.Reqs++ pe.Totals.Sent += ev.Sent pe.Totals.Recv += ev.Recv mc := pe.Models[ev.Model] @@ -7513,7 +7513,7 @@ func TakeSnapshot() (Snapshot, error) { // CacheDir resolves the cache directory for stats. func CacheDir() (string, error) { - if x := os.Getenv("XDG_CACHE_HOME"); stringsTrim(x) != "" { + if x := os.Getenv("XDG_CACHE_HOME"); stringsTrim(x) != "" { return filepath.Join(x, "hexai"), nil } home, err := os.UserHomeDir() -- cgit v1.2.3