agent/cache: Update some docstrings
This commit is contained in:
parent
b478b09312
commit
8aa3335b22
|
@ -167,15 +167,12 @@ type RegisterOptions struct {
|
||||||
// client requests them with MinIndex.
|
// client requests them with MinIndex.
|
||||||
SupportsBlocking bool
|
SupportsBlocking bool
|
||||||
|
|
||||||
// RefreshTimer is the time between attempting to refresh data.
|
// RefreshTimer is the time to sleep between attempts to refresh data.
|
||||||
// If this is zero, then data is refreshed immediately when a fetch
|
// If this is zero, then data is refreshed immediately when a fetch
|
||||||
// is returned.
|
// is returned.
|
||||||
//
|
//
|
||||||
// RefreshTimeout determines the maximum query time for a refresh
|
// Using different values for RefreshTimer and RefreshTimeout, various
|
||||||
// operation. This is specified as part of the query options and is
|
// "refresh" mechanisms can be implemented:
|
||||||
// expected to be implemented by the Type itself.
|
|
||||||
//
|
|
||||||
// Using these values, various "refresh" mechanisms can be implemented:
|
|
||||||
//
|
//
|
||||||
// * With a high timer duration and a low timeout, a timer-based
|
// * With a high timer duration and a low timeout, a timer-based
|
||||||
// refresh can be set that minimizes load on the Consul servers.
|
// refresh can be set that minimizes load on the Consul servers.
|
||||||
|
@ -184,7 +181,11 @@ type RegisterOptions struct {
|
||||||
// refresh can be set so that changes in server data are recognized
|
// refresh can be set so that changes in server data are recognized
|
||||||
// within the cache very quickly.
|
// within the cache very quickly.
|
||||||
//
|
//
|
||||||
RefreshTimer time.Duration
|
RefreshTimer time.Duration
|
||||||
|
|
||||||
|
// RefreshTimeout is the default value for the maximum query time for a fetch
|
||||||
|
// operation. It is set as FetchOptions.Timeout so that cache.Type
|
||||||
|
// implementations can use it as the MaxQueryTime.
|
||||||
RefreshTimeout time.Duration
|
RefreshTimeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,8 +474,7 @@ func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ign
|
||||||
// keepalives are every 30 seconds so the RPC should fail if the packets are
|
// keepalives are every 30 seconds so the RPC should fail if the packets are
|
||||||
// being blackholed for more than 30 seconds.
|
// being blackholed for more than 30 seconds.
|
||||||
var connectedTimer *time.Timer
|
var connectedTimer *time.Timer
|
||||||
if tEntry.Opts.Refresh && entry.Index > 0 &&
|
if tEntry.Opts.Refresh && entry.Index > 0 && tEntry.Opts.RefreshTimeout > 31*time.Second {
|
||||||
tEntry.Opts.RefreshTimeout > (31*time.Second) {
|
|
||||||
connectedTimer = time.AfterFunc(31*time.Second, func() {
|
connectedTimer = time.AfterFunc(31*time.Second, func() {
|
||||||
c.entriesLock.Lock()
|
c.entriesLock.Lock()
|
||||||
defer c.entriesLock.Unlock()
|
defer c.entriesLock.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue