fix dispatcher test

pull/1524/head^2
Darien Raymond 2018-07-03 21:53:36 +02:00
parent 2b0196527d
commit 255090c5c0
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 5 additions and 3 deletions

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)