This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New watch api #122
New watch api #122
Changes from all commits
c584f46
767805a
8018d3a
feb7276
be77fd4
5fd73c6
8569a17
9b1adf5
42405cd
067f696
2ef744a
acc0cca
64597bd
1f7f01e
3705b6b
41d1abd
1607250
5180456
8f2b579
7b1bc5d
f717e73
2acc01d
952546b
8633e8c
db1cb26
07d9e3d
04f26fc
8b0e35c
83a4367
d0c1b57
e271428
38b88a1
f0e5eb9
0f2381f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 could be a little bit simpler, I think:
Also, I'm a bit concerned that this code will panic if the key doesn't contain
versionSeparator
. How sure are we of that?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.
Put
is the only function responsible for writing in that path, I'd say that as long asPut
is tested it should be fine, but I'm open to suggestionsThere 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.
Sleep statements in tests are usually a bit of a smell :)
Why is this one necessary? If it really is necessary, then I'd add a comment.
FWIW my usual approach these days is to poll until some expected condition becomes true, with a timeout in case it doesn't.
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.
I don't like it either, the issue here is that I want to make sure I had the time to run the watch method in the other goroutine before writing data to the database.
I'll add a comment but I'm open to any suggestion
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.
Do you actually need the watch statement to execute before this code? How about adding some rulesets, wait for an event to arrive, then adding some more, so you check both the initial case and the later case? (I'm not entirely sure of the intended semantics when there are rulesets already there though - what's meant to happen?)
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.
ISTM that this won't fail if the watcher produces more events than you want. Perhaps the loop should wait for a while to check that no more arrive?
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.
It can't produce more events because each call to
createBoolRuleset
in the goroutine above will produce exactly one eventThere 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 condition looks redundant to me.
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.