mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
periodically ping client from server
This commit is contained in:
parent
76ea999c01
commit
23a348b4f7
1 changed files with 13 additions and 0 deletions
|
@ -224,6 +224,10 @@ func EventStreamSSE(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// ping the client
|
||||
io.WriteString(rw, ": ping\n\n")
|
||||
flusher.Flush()
|
||||
|
||||
logrus.Debugf("user feed: connection opened")
|
||||
|
||||
user := session.User(c)
|
||||
|
@ -269,6 +273,9 @@ func EventStreamSSE(c *gin.Context) {
|
|||
return
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-time.After(time.Second * 30):
|
||||
io.WriteString(rw, ": ping\n\n")
|
||||
flusher.Flush()
|
||||
case buf, ok := <-eventc:
|
||||
if ok {
|
||||
io.WriteString(rw, "data: ")
|
||||
|
@ -294,6 +301,9 @@ func LogStreamSSE(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
io.WriteString(rw, ": ping\n\n")
|
||||
flusher.Flush()
|
||||
|
||||
// repo := session.Repo(c)
|
||||
//
|
||||
// // parse the build number and job sequence number from
|
||||
|
@ -388,6 +398,9 @@ func LogStreamSSE(c *gin.Context) {
|
|||
return
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-time.After(time.Second * 30):
|
||||
io.WriteString(rw, ": ping\n\n")
|
||||
flusher.Flush()
|
||||
case buf, ok := <-logc:
|
||||
if ok {
|
||||
if id > last {
|
||||
|
|
Loading…
Reference in a new issue