Skip to content

Commit

Permalink
test: dispatcher 包完善测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Jan 12, 2024
1 parent 90b7e4c commit 6f78684
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions server/internal/dispatcher/manager_example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package dispatcher_test

import (
"fmt"
"github.com/kercylan98/minotaur/server/internal/dispatcher"
)

func ExampleNewManager() {
mgr := dispatcher.NewManager[string, *TestMessage](10124*16, func(dispatcher *dispatcher.Dispatcher[string, *TestMessage], message *TestMessage) {
// do something
})
mgr.BindProducer("player_001", "shunt-001")
mgr.BindProducer("player_002", "shunt-002")
mgr.BindProducer("player_003", "shunt-sys")
mgr.BindProducer("player_004", "shunt-sys")
mgr.UnBindProducer("player_001")
mgr.UnBindProducer("player_002")
mgr.UnBindProducer("player_003")
mgr.UnBindProducer("player_004")
mgr.Wait()
fmt.Println("done")
// Output: done
}

0 comments on commit 6f78684

Please sign in to comment.