Skip to content

Commit

Permalink
feat: Fix redis lua script (#25)
Browse files Browse the repository at this point in the history
Signed-off-by: sergeyWh1te <[email protected]>
  • Loading branch information
sergeyWh1te authored Sep 26, 2024
1 parent 35ea1cd commit 172fe73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/app/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,11 @@ func computeSHA256Hash(data []byte) string {

func (w *findingWorker) SetSendingStatus(ctx context.Context, countKey, statusKey string) (bool, error) {
luaScript := `
local count = tonumber(redisClient.call("GET", KEYS[1]))
local count = tonumber(redis.call("GET", KEYS[1]))
if count and count >= tonumber(ARGV[1]) then
local status = redisClient.call("GET", KEYS[2])
local status = redis.call("GET", KEYS[2])
if not status or status == ARGV[2] then
redisClient.call("SET", KEYS[2], ARGV[3])
redis.call("SET", KEYS[2], ARGV[3])
return 1
end
end
Expand Down

0 comments on commit 172fe73

Please sign in to comment.