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

Method Stop

db/active_replicator.go:95–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93}
94
95func (ar *ActiveReplicator) Stop() error {
96
97 if ar.Push == nil && ar.Pull == nil {
98 return fmt.Errorf("Attempted to stop activeReplicator for %s with neither Push nor Pull defined", base.UD(ar.ID))
99 }
100
101 var pushErr error
102 if ar.Push != nil {
103 pushErr = ar.Push.Stop()
104 }
105
106 var pullErr error
107 if ar.Pull != nil {
108 pullErr = ar.Pull.Stop()
109 }
110
111 if pushErr != nil {
112 return pushErr
113 }
114
115 if pullErr != nil {
116 return pullErr
117 }
118
119 if base.ValDefault(ar.config.reportHandlerPanicsOnStop, true) {
120 if stats := ar.config.ReplicationStatsMap; stats != nil {
121 if val := stats.NumHandlersPanicked.Value(); val > 0 {
122 return fmt.Errorf("%d handlers panicked", val)
123 }
124 }
125 }
126
127 return nil
128}
129
130func (ar *ActiveReplicator) Reset() error {
131 var pushErr error

Calls 5

UDFunction · 0.92
ValDefaultFunction · 0.92
ErrorfMethod · 0.80
StopMethod · 0.65
ValueMethod · 0.45