Skip to content

Commit f894560

Browse files
authored
Merge branch 'ndyakov/optional-logger' into optional-logger
2 parents 4be3d3a + b362eb7 commit f894560

File tree

11 files changed

+35
-111
lines changed

11 files changed

+35
-111
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
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:
@@ -83,7 +83,7 @@ jobs:
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

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
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

.github/workflows/doctests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
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

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
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

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
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:

.github/workflows/test-redis-enterprise.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

command.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var keylessCommands = map[string]struct{}{
6464
"sync": {},
6565
"unsubscribe": {},
6666
"unwatch": {},
67+
"wait": {},
6768
}
6869

6970
type Cmder interface {

internal/pool/conn.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff 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.
3336
func 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.
4142
func GetCachedTimeNs() int64 {
4243
return getCachedTimeNs()

internal/pool/global_time_cache.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

internal/pool/pool.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)