MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / stopBackgroundManagers

Method stopBackgroundManagers

db/database.go:671–684  ·  view source on GitHub ↗

stopBackgroundManagers stops any running BackgroundManager. Returns a list of BackgroundManager it signalled to stop

()

Source from the content-addressed store, hash-verified

669// stopBackgroundManagers stops any running BackgroundManager.
670// Returns a list of BackgroundManager it signalled to stop
671func (dbCtx *DatabaseContext) stopBackgroundManagers() (stopped []*BackgroundManager) {
672 for _, manager := range []*BackgroundManager{
673 dbCtx.ResyncManager,
674 dbCtx.AttachmentCompactionManager,
675 dbCtx.TombstoneCompactionManager,
676 dbCtx.AsyncIndexInitManager,
677 dbCtx.AttachmentMigrationManager,
678 } {
679 if manager != nil && !isBackgroundManagerStopped(manager.GetRunState()) && manager.Stop() == nil {
680 stopped = append(stopped, manager)
681 }
682 }
683 return stopped
684}
685
686// waitForBackgroundManagersToStop wait for given BackgroundManagers to stop within given time
687func waitForBackgroundManagersToStop(ctx context.Context, waitTimeMax time.Duration, bgManagers []*BackgroundManager) {

Callers 2

CloseMethod · 0.95

Calls 3

GetRunStateMethod · 0.80
StopMethod · 0.65

Tested by 1