mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-27 03:55:51 +08:00
Remove per task heartbeat
This commit is contained in:
19
rdb.go
19
rdb.go
@@ -9,7 +9,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v7"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Redis keys
|
||||
@@ -147,24 +146,6 @@ func (r *rdb) move(from string, msg *taskMessage) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *rdb) heartbeat(id uuid.UUID, timestamp time.Time) error {
|
||||
key := heartbeatPrefix + id.String()
|
||||
err := r.client.Set(key, timestamp, 0).Err() // zero expiration means no expiration
|
||||
if err != nil {
|
||||
return fmt.Errorf("command SET %s %v failed: %v", key, timestamp, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *rdb) clearHeartbeat(id uuid.UUID) error {
|
||||
key := heartbeatPrefix + id.String()
|
||||
err := r.client.Del(key).Err()
|
||||
if err != nil {
|
||||
return fmt.Errorf("command DEL %s failed: %v", key, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
const maxDeadTask = 100
|
||||
const deadExpirationInDays = 90
|
||||
|
||||
|
||||
Reference in New Issue
Block a user