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

Method _disconnect

db/active_replicator_common.go:370–400  ·  view source on GitHub ↗

_disconnect aborts any replicator processes used during a connected/running replication (checkpointing, blip contexts, etc.)

()

Source from the content-addressed store, hash-verified

368
369// _disconnect aborts any replicator processes used during a connected/running replication (checkpointing, blip contexts, etc.)
370func (arc *activeReplicatorCommon) _disconnect() error {
371 if arc == nil {
372 // noop
373 return nil
374 }
375
376 if arc.checkpointerCtx != nil {
377 base.TracefCtx(arc.ctx, base.KeyReplicate, "cancelling checkpointer context inside _disconnect")
378 arc.checkpointerCtxCancel()
379 _ = arc.forEachCollection(func(c *activeReplicatorCollection) error {
380 c.Checkpointer.closeWg.Wait()
381 c.Checkpointer.CheckpointNow()
382 return nil
383 })
384 }
385 arc.checkpointerCtx = nil
386
387 if arc.blipSender != nil {
388 base.TracefCtx(arc.ctx, base.KeyReplicate, "closing blip sender")
389 arc.blipSender.Close()
390 arc.blipSender = nil
391 }
392
393 if arc.blipSyncContext != nil {
394 base.TracefCtx(arc.ctx, base.KeyReplicate, "closing blip sync context")
395 arc.blipSyncContext.Close()
396 arc.blipSyncContext = nil
397 }
398
399 return nil
400}
401
402// _stop aborts any replicator processes that run outside of a running replication connection (e.g: async reconnect handling, statsreporter)
403func (arc *activeReplicatorCommon) _stop() {

Callers 5

reconnectMethod · 0.95
disconnectMethod · 0.95
stopAndDisconnectMethod · 0.95
CompleteMethod · 0.80
CompleteMethod · 0.80

Calls 5

forEachCollectionMethod · 0.95
TracefCtxFunction · 0.92
CheckpointNowMethod · 0.80
CloseMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected