Skip to content

Commit

Permalink
tryfix: no interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed May 24, 2024
1 parent 226890b commit 6c94343
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions apis/record/yocsef.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ func InferYocsefAsyncAPI(c *websocket.Conn) {
return BadRequest("内容不能为空")
}

ctx, cancel := context.WithCancelCause(context.Background())
defer cancel(errors.New("procedure finished"))
//ctx, cancel := context.WithCancelCause(context.Background())
//defer cancel(errors.New("procedure finished"))

// listen to interrupt and connection close
go func() {
defer cancel(errors.New("client connection closed or interrupt"))
_, _, innerErr := c.ReadMessage()
if innerErr != nil {
return
}
}()
//go func() {
// defer cancel(errors.New("client connection closed or interrupt"))
// _, _, innerErr := c.ReadMessage()
// if innerErr != nil {
// return
// }
//}()

var record *DirectRecord
record, err = service.InferYocsef(
ctx,
context.Background(),
c,
body.Request,
body.Records,
Expand Down

0 comments on commit 6c94343

Please sign in to comment.