fix dispatcher test

This commit is contained in:
Darien Raymond
2018-07-03 21:53:36 +02:00
parent 2b0196527d
commit 255090c5c0
+5 -3
View File
@@ -59,13 +59,15 @@ func TestSameDestinationDispatching(t *testing.T) {
b := buf.New()
b.AppendBytes('a', 'b', 'c', 'd')
dispatcher := NewDispatcher(td)
var msgCount uint32
dispatcher.Dispatch(ctx, dest, b, func(payload *buf.Buffer) {
dispatcher := NewDispatcher(td, func(ctx context.Context, payload *buf.Buffer) {
atomic.AddUint32(&msgCount, 1)
})
dispatcher.Dispatch(ctx, dest, b)
for i := 0; i < 5; i++ {
dispatcher.Dispatch(ctx, dest, b, func(payload *buf.Buffer) {})
dispatcher.Dispatch(ctx, dest, b)
}
time.Sleep(time.Second)