feat: fault tolerance for global caches - #560
Conversation
|
WIP This shows the basic strategy. Has been tested with real world application. Default is to tolerance when doing "lookup" operations, and intolerance when doing anything else, which requires cache invalidation. User may override defaults with big caveat that clients may retrieve stale data from cache if Still need tests to go. Still considering whether or not to add retry functionality for the cache calls. Sharing now for potential early feedback. |
|
This is ready for review and possible merge. I had it about 95% done on Friday. |
cguardia
left a comment
There was a problem hiding this comment.
This looks great. Thanks!
| the application. If :data:`True`, connection errors during write will be | ||
| raised as exceptions in the application. Because write operations involve | ||
| cache invalidation, setting this to :data:`False` may allow other clients to | ||
| retreive stale data from the cache. If there is a connection error, an |
| exception in the application. If :data:`True`, connection errors during | ||
| write will be raised as exceptions in the application. Because write | ||
| operations involve cache invalidation, setting this to :data:`False` may | ||
| allow other clients to retreive stale data from the cache. If there is |
| the application. If :data:`True`, connection errors during write will be | ||
| raised as exceptions in the application. Because write operations involve | ||
| cache invalidation, setting this to :data:`False` may allow other clients to | ||
| retreive stale data from the cache. If there is a connection error, an |
| exception in the application. If :data:`True`, connection errors during | ||
| write will be raised as exceptions in the application. Because write | ||
| operations involve cache invalidation, setting this to :data:`False` may | ||
| allow other clients to retreive stale data from the cache. If there is |
andrewsg
left a comment
There was a problem hiding this comment.
Looks great, just one question before I merge. Thanks!
| _LOCK_TIME = 32 | ||
| _PREFIX = b"NDB30" | ||
|
|
||
| warnings.filterwarnings("always", module=__name__) |
There was a problem hiding this comment.
So I have better context here, what is this intended to filter out and why?
There was a problem hiding this comment.
It's actually unfiltering. The default, for warnings, is to log them once and don't log any duplicates. This is overriding that default so the warnings are shown every time.
| Attributes: | ||
| strict_read (bool): If :data:`True`, transient errors that occur as part of a | ||
| entity lookup operation will be logged as warnings but not raised to the | ||
| application layer. |
There was a problem hiding this comment.
That description seems reversed. Same for strict_write below.
Closes #557