waitForReleasedSequences blocks for 'releaseSequenceWait' past the provided startTime. Used to guarantee assignment of allocated sequences on other nodes.
(ctx context.Context, startTime time.Time)
| 439 | // waitForReleasedSequences blocks for 'releaseSequenceWait' past the provided startTime. |
| 440 | // Used to guarantee assignment of allocated sequences on other nodes. |
| 441 | func (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 |
| 453 | func (s *sequenceAllocator) _fixSyncSeqRollback(ctx context.Context, prevAllocTo, expectedValue uint64) (allocatedToSeq uint64, err error) { |