mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-13 05:28:16 +08:00
ui界面优化,event handler优化-新增任务池模式,歌词加载优化,新房间管理(可以自动连接) 本地音频搜索算法优化,
This commit is contained in:
35
common/event/event_test.go
Normal file
35
common/event/event_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package event
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestEventSeq(t *testing.T) {
|
||||
m := NewManger(128, 16)
|
||||
m.RegisterA("ceshi", "asdf1", func(event *Event) {
|
||||
fmt.Println("Num:", event.Data)
|
||||
})
|
||||
go func() {
|
||||
for i := 0; i < 1000; i++ {
|
||||
m.CallA("ceshi", fmt.Sprintf("a%d", i))
|
||||
}
|
||||
}()
|
||||
for i := 0; i < 1000; i++ {
|
||||
m.CallA("ceshi", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEventWeired(t *testing.T) {
|
||||
m := NewManger(128, 2)
|
||||
m.RegisterA("playlist.update", "asdf1", func(event *Event) {
|
||||
fmt.Printf("%d %p, outdated: %t\n", event.Data, event, event.Outdated)
|
||||
})
|
||||
for i := 0; i < 2; i++ {
|
||||
fmt.Println("asdfsafasfasfasfasfasf")
|
||||
m.CallA("playlist.update", i)
|
||||
fmt.Println("asdfsafasfasfasfasfasf")
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
Reference in New Issue
Block a user