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

Method waitForReleasedSequences

db/sequence_allocator.go:441–450  ·  view source on GitHub ↗

waitForReleasedSequences blocks for 'releaseSequenceWait' past the provided startTime. Used to guarantee assignment of allocated sequences on other nodes.

(ctx context.Context, startTime time.Time)

Source from the content-addressed store, hash-verified

439// waitForReleasedSequences blocks for 'releaseSequenceWait' past the provided startTime.
440// Used to guarantee assignment of allocated sequences on other nodes.
441func (s *sequenceAllocator) waitForReleasedSequences(ctx context.Context, startTime time.Time) (waitedFor time.Duration) {
442
443 requiredWait := s.releaseSequenceWait - time.Since(startTime)
444 if requiredWait < 0 {
445 return 0
446 }
447 base.InfofCtx(ctx, base.KeyCache, "Waiting %v for sequence allocation...", requiredWait)
448 time.Sleep(requiredWait)
449 return requiredWait
450}
451
452// _fixSyncSeqRollback will correct a rolled back _sync:seq document in the bucket
453func (s *sequenceAllocator) _fixSyncSeqRollback(ctx context.Context, prevAllocTo, expectedValue uint64) (allocatedToSeq uint64, err error) {

Callers 2

StartOnlineProcessesMethod · 0.80
TestReleaseSequenceWaitFunction · 0.80

Calls 2

InfofCtxFunction · 0.92
SinceMethod · 0.45

Tested by 1

TestReleaseSequenceWaitFunction · 0.64