goc server, non-block channel -> block
This commit is contained in:
parent
cf44927ce9
commit
244be86304
@ -69,7 +69,7 @@ func skipCopy(src string, info os.FileInfo) (bool, error) {
|
|||||||
func (b *Build) clean() {
|
func (b *Build) clean() {
|
||||||
if config.GocConfig.Debug != true {
|
if config.GocConfig.Debug != true {
|
||||||
if err := os.RemoveAll(config.GocConfig.TmpModProjectDir); err != nil {
|
if err := os.RemoveAll(config.GocConfig.TmpModProjectDir); err != nil {
|
||||||
log.Fatalf("fail to delete the temporary project: %v", config.GocConfig.TmpModProjectDir)
|
log.Fatalf("fail to delete the temporary project: %v", err)
|
||||||
}
|
}
|
||||||
log.Donef("delete the temporary project")
|
log.Donef("delete the temporary project")
|
||||||
} else {
|
} else {
|
||||||
|
@ -55,7 +55,7 @@ func RunGocServerUntilExit(host string) {
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watchCh: make(chan []byte),
|
watchCh: make(chan []byte, 4096),
|
||||||
}
|
}
|
||||||
|
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
@ -74,11 +74,7 @@ func (gs *gocServer) serveWatchInternalStream(c *gin.Context) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if mt == websocket.TextMessage {
|
if mt == websocket.TextMessage {
|
||||||
// 非阻塞写
|
gs.watchCh <- message
|
||||||
select {
|
|
||||||
case gs.watchCh <- message:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user