解决部分已知bug

This commit is contained in:
2025-02-27 11:36:40 +08:00
parent 593d7758bf
commit 8780f8555e
14 changed files with 96 additions and 59 deletions

View File

@@ -4,6 +4,7 @@ import (
"game-driver/internal/common"
"game-driver/leaf"
"go.uber.org/zap"
"sync"
)
// EmergencyStop 紧急停止中间件
@@ -12,13 +13,19 @@ func EmergencyStop(stopper common.Stopper) leaf.HandlerFunc {
cancel := leaf.WithCancel(c)
defer stopper.Reset()
// 等待组
var wait sync.WaitGroup
defer wait.Wait()
// 结束信号通道
a := make(chan struct{})
// 发送结束信号
defer close(a)
zap.S().Infoln("监听停止信号")
wait.Add(1)
go func() {
defer wait.Done()
defer zap.S().Infoln("结束停止信号监听")
select {

View File

@@ -9,6 +9,7 @@ import (
"time"
)
// TickerAction 定时器动作,用于在指定时间点执行打印和语音播报
func TickerAction() leaf.HandlerFunc {
return func(c *leaf.Context) {
pm := leaf.Value[*schema.PlayModal](c, PayloadJSONKey)

View File

@@ -8,7 +8,7 @@ import (
"time"
)
// TimeoutOver 定时器中间件,用于定时触发屏幕打印和语音播报。 t 是语音播报实例
// TimeoutOver 超时停止
func TimeoutOver(maxTimeout int) leaf.HandlerFunc {
return func(c *leaf.Context) {
pm := leaf.Value[*schema.PlayModal](c, PayloadJSONKey)