MCPcopy Create free account
hub / github.com/QuantumNous/new-api / waitForTaskPluginProtocolTick

Function waitForTaskPluginProtocolTick

controller/plugin_protocol.go:614–637  ·  view source on GitHub ↗
(
	c *gin.Context,
	observationContext context.Context,
	heartbeatTicker *time.Ticker,
	delay time.Duration,
)

Source from the content-addressed store, hash-verified

612}
613
614func 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
639func waitTaskPluginProtocol(
640 c *gin.Context,

Callers 1

streamTaskPluginProtocolFunction · 0.85

Calls 4

ExtendWriteDeadlineFunction · 0.92
StopMethod · 0.80
DoneMethod · 0.80

Tested by

no test coverage detected