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

Method fetchConfigsSince

rest/config.go:1934–1949  ·  view source on GitHub ↗

fetchConfigsSince returns database configs from the server context. These configs are refreshed before returning if they are older than the refreshInterval. The refreshInterval defaults to DefaultMinConfigFetchInterval if nil.

(ctx context.Context, refreshInterval *base.ConfigDuration)

Source from the content-addressed store, hash-verified

1932// fetchConfigsSince returns database configs from the server context. These configs are refreshed before returning if
1933// they are older than the refreshInterval. The refreshInterval defaults to DefaultMinConfigFetchInterval if nil.
1934func (sc *ServerContext) fetchConfigsSince(ctx context.Context, refreshInterval *base.ConfigDuration) (dbNameConfigs map[string]*RuntimeDatabaseConfig, err error) {
1935 minInterval := DefaultMinConfigFetchInterval
1936 if refreshInterval != nil {
1937 minInterval = refreshInterval.Value()
1938 }
1939
1940 if time.Since(sc.fetchConfigsLastUpdate) > minInterval {
1941 _, err = sc.fetchAndLoadConfigs(ctx, false)
1942 if err != nil {
1943 return nil, err
1944 }
1945 sc.fetchConfigsLastUpdate = time.Now()
1946 }
1947
1948 return sc._dbConfigs, nil
1949}
1950
1951// GetBucketNames returns a slice of the bucket names associated with the server context
1952func (sc *ServerContext) GetBucketNames() (buckets []string, err error) {

Callers 2

Calls 3

fetchAndLoadConfigsMethod · 0.95
ValueMethod · 0.45
SinceMethod · 0.45

Tested by 1