Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 17, 2021

Conversation

Oberonus
Copy link
Contributor

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