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

Method _stopOnlineProcesses

db/database.go:623–638  ·  view source on GitHub ↗

_stopOnlineProcesses is called to represent an error condition from startOnlineProcesses, or from DatabaseContext.Close. Most of the objects are not safe to close twice, since they have internal terminator objects and goroutines that wait on closed channels. Acquire the bucket lock, to avoid calling

(ctx context.Context)

Source from the content-addressed store, hash-verified

621
622// _stopOnlineProcesses is called to represent an error condition from startOnlineProcesses, or from DatabaseContext.Close. Most of the objects are not safe to close twice, since they have internal terminator objects and goroutines that wait on closed channels. Acquire the bucket lock, to avoid calling this function multiple times.
623func (db *DatabaseContext) _stopOnlineProcesses(ctx context.Context) {
624 db.mutationListener.Stop(ctx)
625 db.changeCache.Stop(ctx)
626 if db.ImportListener != nil {
627 db.ImportListener.Stop()
628 db.ImportListener = nil
629 }
630 if db.Heartbeater != nil {
631 db.Heartbeater.Stop(ctx)
632 db.Heartbeater = nil
633 }
634 if db.SGReplicateMgr != nil {
635 db.SGReplicateMgr.Stop()
636 db.SGReplicateMgr = nil
637 }
638}
639
640func (context *DatabaseContext) Close(ctx context.Context) {
641 context.BucketLock.Lock()

Callers 3

CloseMethod · 0.95
StartOnlineProcessesMethod · 0.95

Calls 1

StopMethod · 0.65

Tested by 1