forked from hashicorp/consul
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Streaming][Bugfix] Fix error(s) on services not being modified befor…
…e cache TTL On services not changing much, using the streaming would cause some errors with context.canceled being returned. This was caused by TTL of cache being lower than entry TTL. With streaming, there is no garantee that data will be updated before 10 minutes, thus cache was expiring while request was stil on flight. We thus ensure that at least a NotModified data will be issued before the cache does expires. Another problem that was when the data was being updated because the cache background routine was stopped because entry did expire. A new error `ErrCacheRefreshRoutineStopped` has been added to ensure this result cannot pollute the cache with wrong data. Added unit test Be sure to avoid return Valid entry while not present Protect from cache failures When TTL expires during the initial fetch of streaming, implementation could return invalid data More complete fix: avoid the case where cache could not be initialized before streaming has been init Added test case Use correct condition for invalid cache entry Minor improbements for new unit test `TestStreamingHealthServices_IntegrationWithCache_Expiry`.
- Loading branch information
1 parent
ca2c3eb
commit 78031c6
Showing
6 changed files
with
151 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters