Browse Source

Merge pull request #304 from songzhibin97/gva_gormv2_dev

修改了热更正在运行时重启信号的丢弃
main
奇淼(piexlmax 4 years ago
committed by GitHub
parent
commit
8aae01defb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      server/utils/cmd_Task.go

11
server/utils/cmd_Task.go

@ -73,17 +73,12 @@ func newT(f func(chan struct{}) error) *T {
//@description: 添加任务 //@description: 添加任务
func (t *T) AddTask() { func (t *T) AddTask() {
if len(t.ch) == 1 {
return
}
t.Lock()
defer t.Unlock()
if len(t.ch) == 1 {
select {
case t.ch <- struct{}{}:
default:
// 代表已经有任务了 // 代表已经有任务了
// 直接丢弃这次任务 // 直接丢弃这次任务
return
} }
t.ch <- struct{}{}
} }
//@author: [songzhibin97](https://github.com/songzhibin97) //@author: [songzhibin97](https://github.com/songzhibin97)

Loading…
Cancel
Save