MCPcopy
hub / github.com/github/gh-ost / IsThrottled

Method IsThrottled

go/base/context.go:728–742  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

726}
727
728func (mctx *MigrationContext) IsThrottled() (bool, string, ThrottleReasonHint) {
729 mctx.throttleMutex.Lock()
730 defer mctx.throttleMutex.Unlock()
731
732 // we don't throttle when cutting over. We _do_ throttle:
733 // - during copy phase
734 // - just before cut-over
735 // - in between cut-over retries
736 // When cutting over, we need to be aggressive. Cut-over holds table locks.
737 // We need to release those asap.
738 if atomic.LoadInt64(&mctx.InCutOverCriticalSectionFlag) > 0 {
739 return false, "critical section", NoThrottleReasonHint
740 }
741 return mctx.isThrottled, mctx.throttleReason, mctx.throttleReasonHint
742}
743
744func (mctx *MigrationContext) GetThrottleQuery() string {
745 mctx.throttleMutex.Lock()

Callers 4

throttleMethod · 0.80
InitiateHeartbeatMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected