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

Method waitForCacheUpdate

db/changes.go:1207–1222  ·  view source on GitHub ↗
(ctx context.Context, currentCachedSequence uint64)

Source from the content-addressed store, hash-verified

1205}
1206
1207func (col *DatabaseCollectionWithUser) waitForCacheUpdate(ctx context.Context, currentCachedSequence uint64) (cancelled bool) {
1208 ticker := time.NewTicker(100 * time.Millisecond)
1209 defer ticker.Stop()
1210 for retry := 0; retry <= 50; retry++ {
1211 select {
1212 // Check if feed has been terminated regardless of if any changes have happened
1213 case <-ctx.Done():
1214 return true
1215 case <-ticker.C:
1216 if col.changeCache().getChannelCache().GetHighCacheSequence() != currentCachedSequence {
1217 return false
1218 }
1219 }
1220 }
1221 return false
1222}
1223
1224// Returns the set of cached log entries for a given channel
1225func (c *DatabaseCollection) GetChangeLog(ctx context.Context, channel channels.ID, afterSeq uint64) (entries []*LogEntry, err error) {

Callers 1

Calls 5

DoneMethod · 0.80
changeCacheMethod · 0.80
StopMethod · 0.65
GetHighCacheSequenceMethod · 0.65
getChannelCacheMethod · 0.45

Tested by

no test coverage detected