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)
| 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. |
| 1934 | func (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 |
| 1952 | func (sc *ServerContext) GetBucketNames() (buckets []string, err error) { |