( c *gin.Context, observationContext context.Context, heartbeatTicker *time.Ticker, delay time.Duration, )
| 612 | } |
| 613 | |
| 614 | func waitForTaskPluginProtocolTick( |
| 615 | c *gin.Context, |
| 616 | observationContext context.Context, |
| 617 | heartbeatTicker *time.Ticker, |
| 618 | delay time.Duration, |
| 619 | ) bool { |
| 620 | tickTimer := time.NewTimer(delay) |
| 621 | defer tickTimer.Stop() |
| 622 | for { |
| 623 | select { |
| 624 | case <-c.Request.Context().Done(): |
| 625 | return false |
| 626 | case <-observationContext.Done(): |
| 627 | return false |
| 628 | case <-heartbeatTicker.C: |
| 629 | helper.ExtendWriteDeadline(c) |
| 630 | if err := writeTaskPluginProtocolHeartbeat(c); err != nil { |
| 631 | return false |
| 632 | } |
| 633 | case <-tickTimer.C: |
| 634 | return true |
| 635 | } |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | func waitTaskPluginProtocol( |
| 640 | c *gin.Context, |
no test coverage detected