File tree Expand file tree Collapse file tree 11 files changed +35
-111
lines changed Expand file tree Collapse file tree 11 files changed +35
-111
lines changed Original file line number Diff line number Diff line change 3232 go-version : ${{ matrix.go-version }}
3333
3434 - name : Checkout code
35- uses : actions/checkout@v5
35+ uses : actions/checkout@v6
3636
3737 - name : Setup Test environment
3838 env :
8383
8484 steps :
8585 - name : Checkout code
86- uses : actions/checkout@v5
86+ uses : actions/checkout@v6
8787
8888 - name : Run tests
8989 uses : ./.github/actions/run-tests
Original file line number Diff line number Diff line change 3535
3636 steps :
3737 - name : Checkout repository
38- uses : actions/checkout@v5
38+ uses : actions/checkout@v6
3939
4040 # Initializes the CodeQL tools for scanning.
4141 - name : Initialize CodeQL
Original file line number Diff line number Diff line change 3636 go-version : ${{ matrix.go-version }}
3737
3838 - name : Checkout code
39- uses : actions/checkout@v5
39+ uses : actions/checkout@v6
4040
4141 - name : Test doc examples
4242 working-directory : ./doctests
Original file line number Diff line number Diff line change 2020 name : lint
2121 runs-on : ubuntu-latest
2222 steps :
23- - uses : actions/checkout@v5
23+ - uses : actions/checkout@v6
2424 - name : golangci-lint
25- uses : golangci/golangci-lint-action@v9.0 .0
25+ uses : golangci/golangci-lint-action@v9.1 .0
2626 with :
2727 verify : true
2828
Original file line number Diff line number Diff line change 66 runs-on : ubuntu-latest
77 steps :
88 - name : Checkout
9- uses : actions/checkout@v5
9+ uses : actions/checkout@v6
1010 - name : Check Spelling
1111 uses : rojopolis/spellcheck-github-actions@0.54.0
1212 with :
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ jobs:
2020
2121 steps :
2222 - name : Checkout code
23- uses : actions/checkout@v5
23+ uses : actions/checkout@v6
2424
2525 - name : Clone Redis EE docker repository
26- uses : actions/checkout@v5
26+ uses : actions/checkout@v6
2727 with :
2828 repository : RedisLabs/redis-ee-docker
2929 path : redis-ee
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ var keylessCommands = map[string]struct{}{
6464 "sync" : {},
6565 "unsubscribe" : {},
6666 "unwatch" : {},
67+ "wait" : {},
6768}
6869
6970type Cmder interface {
Original file line number Diff line number Diff line change @@ -27,16 +27,17 @@ var (
2727 errConnNotAvailableForWrite = errors .New ("redis: connection not available for write operation" )
2828)
2929
30- // getCachedTimeNs returns the current time in nanoseconds from the global cache.
31- // This is updated every 50ms by a background goroutine, avoiding expensive syscalls.
32- // Max staleness: 50ms.
30+ // getCachedTimeNs returns the current time in nanoseconds.
31+ // This function previously used a global cache updated by a background goroutine,
32+ // but that caused unnecessary CPU usage when the client was idle (ticker waking up
33+ // the scheduler every 50ms). We now use time.Now() directly, which is fast enough
34+ // on modern systems (vDSO on Linux) and only adds ~1-2% overhead in extreme
35+ // high-concurrency benchmarks while eliminating idle CPU usage.
3336func getCachedTimeNs () int64 {
34- return globalTimeCache . nowNs . Load ()
37+ return time . Now (). UnixNano ()
3538}
3639
37- // GetCachedTimeNs returns the current time in nanoseconds from the global cache.
38- // This is updated every 50ms by a background goroutine, avoiding expensive syscalls.
39- // Max staleness: 50ms.
40+ // GetCachedTimeNs returns the current time in nanoseconds.
4041// Exported for use by other packages that need fast time access.
4142func GetCachedTimeNs () int64 {
4243 return getCachedTimeNs ()
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -182,9 +182,6 @@ func NewConnPool(opt *Options) *ConnPool {
182182 p .connsMu .Unlock ()
183183 }
184184
185- startGlobalTimeCache ()
186- subscribeToGlobalTimeCache ()
187-
188185 return p
189186}
190187
@@ -985,9 +982,6 @@ func (p *ConnPool) Close() error {
985982 return ErrClosed
986983 }
987984
988- unsubscribeFromGlobalTimeCache ()
989- stopGlobalTimeCache ()
990-
991985 var firstErr error
992986 p .connsMu .Lock ()
993987 for _ , cn := range p .conns {
You can’t perform that action at this time.
0 commit comments