-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add etcd elector for gocron #1
Conversation
please code review for the pr. 😁 help me see where I need to modify. 😆 |
elector.go
Outdated
continue | ||
} | ||
|
||
val := string(resp.Kvs[0].Value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will more than one value ever be returned in Kvs? would that matter?
val := string(resp.Kvs[0].Value) | |
val := string(resp.Kvs[0].Value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
After my test, I received only one kv every time. But for the sake of code robustness, for range
is still used.
e.leaderID = id | ||
} | ||
|
||
func (e *Elector) Start(electionPath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add documentation to the exported functions 😄 for example. what should the value of electionPath be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is lovely
you could pull in the github repo from go cron so the tests will run 😄 https://github.com/go-co-op/gocron-redis-lock/tree/main/.github |
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Signed-off-by: rfyiamcool <[email protected]>
Signed-off-by: rfyiamcool <[email protected]>
51eba9e
to
a4feb3e
Compare
done. I'm really sorry that I just noticed that this PR has been updated. I always thought you didn't see this PR. 哈哈 I'm sorry, this is my fault. |
no worries! Thanks for adding this 😄 |
summary
add etcd elector for gocron.
because the etcd test library was not found, the etcd service needs to be started before unit testing.
refer
go-co-op/gocron#561