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() {
|
||||
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 {
|
||||
|
@ -55,7 +55,7 @@ func RunGocServerUntilExit(host string) {
|
||||
return true
|
||||
},
|
||||
},
|
||||
watchCh: make(chan []byte),
|
||||
watchCh: make(chan []byte, 4096),
|
||||
}
|
||||
|
||||
r := gin.Default()
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user