Skip to content

Add early return to Redis watcher in case of MGET error to avoid panicking#91

Merged
mantzas merged 1 commit intobeatlabs:masterfrom
Oberonus:fix-redis-watcher-panic-on-error
Jun 17, 2021
Merged

Add early return to Redis watcher in case of MGET error to avoid panicking#91
mantzas merged 1 commit intobeatlabs:masterfrom
Oberonus:fix-redis-watcher-panic-on-error

Conversation

@Oberonus
Copy link
Member

Which problem is this PR solving?

In case of MGET error current implementation still expects resulting values array to have the same length as keys array, tries to iterave over them and panicks with:

runtime error: index out of range [0]
github.com/beatlabs/harvester/monitor/redis.(*Watcher).
      getValues(0xc00011dad0, 0x1516268, 0xc000042050, 
      /go/sonar/vendor/github.com/beatlabs/harvester/monitor/redis/watcher.go:75
github.com/beatlabs/harvester/monitor/redis.(*Watcher).
      monitor(0xc00011dad0, 0x1516268, 0xc000042050, 0xc0001311a0) 
      /go/sonar/vendor/github.com/beatlabs/harvester/monitor/redis/watcher.go:62

Short description of the changes

Add an early return in case of error.

@mantzas mantzas merged commit 038cd6a into beatlabs:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants