mirror of
https://github.com/hibiken/asynq.git
synced 2026-05-05 07:36:25 +08:00
Compare commits
4 Commits
sohail/v0.
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6dc3c1c007 | ||
|
|
23905a286f | ||
|
|
5586efeae7 | ||
|
|
dd3c923f44 |
6
.github/workflows/benchstat.yml
vendored
6
.github/workflows/benchstat.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
- name: Benchmark
|
||||
run: go test -run=^$ -bench=. -count=5 -timeout=60m ./... | tee -a new.txt
|
||||
- name: Upload Benchmark
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: bench-incoming
|
||||
path: new.txt
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
- name: Benchmark
|
||||
run: go test -run=^$ -bench=. -count=5 -timeout=60m ./... | tee -a old.txt
|
||||
- name: Upload Benchmark
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: bench-current
|
||||
path: old.txt
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
- name: Benchstat Results
|
||||
run: benchstat old.txt new.txt | tee -a benchstat.txt
|
||||
- name: Upload benchstat results
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: benchstat
|
||||
path: benchstat.txt
|
||||
|
||||
@@ -1488,6 +1488,7 @@ func (r *RDB) CancelationPubSub() (*redis.PubSub, error) {
|
||||
pubsub := r.client.Subscribe(ctx, base.CancelChannel)
|
||||
_, err := pubsub.Receive(ctx)
|
||||
if err != nil {
|
||||
pubsub.Close()
|
||||
return nil, errors.E(op, errors.Unknown, fmt.Sprintf("redis pubsub receive error: %v", err))
|
||||
}
|
||||
return pubsub, nil
|
||||
|
||||
@@ -3274,6 +3274,29 @@ func TestCancelationPubSub(t *testing.T) {
|
||||
mu.Unlock()
|
||||
}
|
||||
|
||||
func TestCancelationPubSubReceiveError(t *testing.T) {
|
||||
// Use a client connected to a non-existent Redis server to trigger
|
||||
// a Receive() error. This verifies that the pubsub connection is
|
||||
// closed on error, preventing connection leaks.
|
||||
client := redis.NewClient(&redis.Options{
|
||||
Addr: "localhost:0", // invalid port — connection will fail
|
||||
})
|
||||
r := NewRDB(client)
|
||||
defer r.Close()
|
||||
|
||||
pubsub, err := r.CancelationPubSub()
|
||||
if err == nil {
|
||||
// If no error, we must clean up the pubsub.
|
||||
if pubsub != nil {
|
||||
pubsub.Close()
|
||||
}
|
||||
t.Fatal("(*RDB).CancelationPubSub() expected to return an error when redis is unreachable")
|
||||
}
|
||||
if pubsub != nil {
|
||||
t.Error("(*RDB).CancelationPubSub() expected nil pubsub on error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteResult(t *testing.T) {
|
||||
r := setup(t)
|
||||
defer r.Close()
|
||||
|
||||
Reference in New Issue
Block a user