goc server, non-block channel -> block

This commit is contained in:
lyyyuna 2021-06-24 15:33:49 +08:00
parent cf44927ce9
commit 244be86304
3 changed files with 3 additions and 7 deletions

View File

@ -69,7 +69,7 @@ func skipCopy(src string, info os.FileInfo) (bool, error) {
func (b *Build) clean() {
if config.GocConfig.Debug != true {
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")
} else {

View File

@ -55,7 +55,7 @@ func RunGocServerUntilExit(host string) {
return true
},
},
watchCh: make(chan []byte),
watchCh: make(chan []byte, 4096),
}
r := gin.Default()

View File

@ -74,11 +74,7 @@ func (gs *gocServer) serveWatchInternalStream(c *gin.Context) {
break
}
if mt == websocket.TextMessage {
// 非阻塞写
select {
case gs.watchCh <- message:
default:
}
gs.watchCh <- message
}
}
}