_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)
| 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. |
| 623 | func (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 | |
| 640 | func (context *DatabaseContext) Close(ctx context.Context) { |
| 641 | context.BucketLock.Lock() |