-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 support for closing publisher.Client #1402
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5fab340
Init support for closing publisher.Client
c153fbf
refactor + fixes in client close
c15d4f8
close canceler done channel
8ce0a6e
force beats to connect to publisher
18be356
topbeat close publisher.Client on stop
d00bf85
Winlogbeat close publisher.client
75abe2b
Packetbeat close publisher client on stop
45f70e9
filebeat publish shutdown
28ef50c
Fix mockbeat
0dd6100
Fix typos
a4b652e
Enforce all clients must have disconnected
f202041
update winlogbeat stopping behavior
e1583ef
clarify filebeat publisher exit on registrar queue
9ccc09d
remove obsolete 'failures' from winlogbeat expvars
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package op | ||
|
||
import "sync" | ||
|
||
type Canceler struct { | ||
lock sync.RWMutex | ||
done chan struct{} | ||
active bool | ||
} | ||
|
||
func NewCanceler() *Canceler { | ||
return &Canceler{ | ||
done: make(chan struct{}), | ||
active: true, | ||
} | ||
} | ||
|
||
func (c *Canceler) Cancel() { | ||
c.lock.Lock() | ||
c.active = false | ||
c.lock.Unlock() | ||
|
||
close(c.done) | ||
} | ||
|
||
func (c *Canceler) Done() <-chan struct{} { | ||
return c.done | ||
} |
Oops, something went wrong.
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.
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.
Comment 2 lines above says differently :-) Why don't we update the registrar here?
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.
we're forwarding registrar updates via queue. If queue is blocking, but stop signal has been send (p.done being closed), we do not wait for registrar to finish writing, but instead prefer to shut-down and resend the same line on next restart. This is old behavior, I just added info message notifying users on shutdown registrar will not be updated anymore.
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.
Sounds good to me, but we should probably update the comment.
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.
improved code comment