Skip to content

Commit

Permalink
bugfix: domain cache previously has a hard expiration, which cannot b…
Browse files Browse the repository at this point in the history
…e updated, this expiration, in combination with periodical refresh of domains in v2 table, can cause domain missing for a short period of time. (#855)
  • Loading branch information
wxing1292 authored Jun 14, 2018
1 parent 3d019ba commit 1276b22
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/cache/domainCache.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ import (

const (
domainCacheInitialSize = 10 * 1024
domainCacheMaxSize = 16 * 1024
domainCacheTTL = time.Hour
domainCacheMaxSize = 64 * 1024
domainCacheTTL = 0 // 0 means infinity
domainCacheEntryTTL = 20 * time.Second
domainCacheRefreshInterval = 10 * time.Second
domainCacheRefreshPageSize = 100

Expand Down Expand Up @@ -364,7 +365,7 @@ func (c *domainCache) updateIDToDomainCache(id string, record *DomainCacheEntry)
entry.isGlobalDomain = record.isGlobalDomain
entry.failoverNotificationVersion = record.failoverNotificationVersion
entry.notificationVersion = record.notificationVersion
entry.expiry = c.timeSource.Now().Add(domainCacheRefreshInterval)
entry.expiry = c.timeSource.Now().Add(domainCacheEntryTTL)

nextDomain := entry.duplicate()
if triggerCallback {
Expand Down

0 comments on commit 1276b22

Please sign in to comment.