Skip to content

Commit

Permalink
Merge pull request #5 from gol4ng/fixup
Browse files Browse the repository at this point in the history
Fix forgotten signature
  • Loading branch information
instabledesign authored Sep 24, 2021
2 parents 624ed59 + 42b31b3 commit 7aea9dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions dispatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Test_Dispatcher_WithReasonHandler(t *testing.T) {

func Test_Dispatcher_WithEmitter(t *testing.T) {
d := stop_dispatcher.NewDispatcher(
stop_dispatcher.WithEmitter(func(stopFn stop_dispatcher.ReasonHandler) {
stop_dispatcher.WithEmitter(func(stopFn func(stop_dispatcher.Reason)) {
time.AfterFunc(10*time.Millisecond, func() {
stopFn("fake_reason")
})
Expand All @@ -92,7 +92,7 @@ func Test_Dispatcher_UnregisterCallback(t *testing.T) {
safeInnerStopFn := sync.Mutex{}
var innerStopFn func(stop_dispatcher.Reason)
d := stop_dispatcher.NewDispatcher(
stop_dispatcher.WithEmitter(func(stopFn stop_dispatcher.ReasonHandler) {
stop_dispatcher.WithEmitter(func(stopFn func(stop_dispatcher.Reason)) {
safeInnerStopFn.Lock()
innerStopFn = stopFn
safeInnerStopFn.Unlock()
Expand Down Expand Up @@ -135,7 +135,7 @@ func Test_Dispatcher(t *testing.T) {
callbackCalled = true
return nil
})
d.RegisterEmitter(func(stopFn stop_dispatcher.ReasonHandler) {
d.RegisterEmitter(func(stopFn func(stop_dispatcher.Reason)) {
time.AfterFunc(10*time.Millisecond, func() {
stopFn("fake_reason")
})
Expand Down Expand Up @@ -173,7 +173,7 @@ func Test_Dispatcher_Prioritize(t *testing.T) {
step = append(step, "priority:3_index:0")
return nil
})
d.RegisterEmitter(func(stopFn stop_dispatcher.ReasonHandler) {
d.RegisterEmitter(func(stopFn func(stop_dispatcher.Reason)) {
time.AfterFunc(10*time.Millisecond, func() {
stopFn("fake_reason")
})
Expand Down
4 changes: 2 additions & 2 deletions stop_emitter/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func DefaultSignalEmitter() stop_dispatcher.Emitter {

// SignalEmitter will emit stop reason when signal was received
func SignalEmitter(signals ...os.Signal) stop_dispatcher.Emitter {
return func(stop stop_dispatcher.ReasonHandler) {
return func(stop func(stop_dispatcher.Reason)) {
signalChan := make(chan os.Signal, 1)
signalNotify(signalChan, signals...)
stop(<-signalChan)
Expand All @@ -35,7 +35,7 @@ func DefaultKillerSignalEmitter() stop_dispatcher.Emitter {
// KillerSignalEmitter will emit stop reason when signal was received
// it exit if signal was received a second time
func KillerSignalEmitter(signals ...os.Signal) stop_dispatcher.Emitter {
return func(stop stop_dispatcher.ReasonHandler) {
return func(stop func(stop_dispatcher.Reason)) {
signalReceived := false
signalChan := make(chan os.Signal, 2)
signalNotify(signalChan, signals...)
Expand Down

0 comments on commit 7aea9dc

Please sign in to comment.