Skip to content

Commit

Permalink
Merge pull request #61 from kesonan/fix/59
Browse files Browse the repository at this point in the history
fix #59
  • Loading branch information
kevwan committed Apr 8, 2024
2 parents 4a99c09 + a8f1bf1 commit 28fb062
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dq/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

const (
expiration = 3600 // seconds
guardValue = "1"
tolerance = time.Minute * 30
)

Expand Down Expand Up @@ -51,7 +50,9 @@ func (c *consumerCluster) Consume(consume Consume) {
return
}

ok, err := c.red.SetnxEx(key, guardValue, expiration)
redisLock := redis.NewRedisLock(c.red, key)
redisLock.SetExpire(expiration)
ok, err := redisLock.Acquire()
if err != nil {
logx.Error(err)
} else if ok {
Expand Down

0 comments on commit 28fb062

Please sign in to comment.