优化全局zap的打印,修复待机任务出现多个的情况

This commit is contained in:
2024-11-12 14:47:20 +08:00
parent 355880c3f9
commit cc12b60437
20 changed files with 181 additions and 84 deletions

View File

@@ -3,6 +3,7 @@ package common
import (
"context"
"fmt"
"game-driver/pkg/logger"
"github.com/eclipse/paho.golang/autopaho"
"github.com/eclipse/paho.golang/paho"
"sync"
@@ -29,12 +30,14 @@ func (d *Device) Lock() {
defer d.OnChange()
d.mu.Lock()
d.status.Store(1)
logger.Infoln("设备上锁")
}
func (d *Device) Unlock() {
defer d.OnChange()
d.status.Store(0)
d.mu.Unlock()
logger.Infoln("设备解锁")
}
func (d *Device) Status() int {