forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for closing publisher.Client (elastic#1402)
* Init support for closing publisher.Client * refactor + fixes in client close - refactor signaling moving duplicated code from publisher/outputs to libbeat/common/op - do not wait until pipelines are emptied by outputs on shutdown (clients must be disconnected before shutdown) - fix cancel signaler in broker worker (in pipeline) - proper signal cancel if publisher.Client has been disconnected * close canceler done channel * force beats to connect to publisher * topbeat close publisher.Client on stop * Winlogbeat close publisher.client * Packetbeat close publisher client on stop * filebeat publish shutdown * Fix mockbeat * Fix typos * Enforce all clients must have disconnected publisher pipeline stop method requires all clients having disconnected before shutting down the pipeline. If this is not the case we will generated a panic. * update winlogbeat stopping behavior * clarify filebeat publisher exit on registrar queue * remove obsolete 'failures' from winlogbeat expvars
- Loading branch information
1 parent
8abd826
commit 57477cf
Showing
47 changed files
with
889 additions
and
710 deletions.
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.