Skip to content

RedisClient: add redis_flakey mechanism to avoid repeated timeouts#1361

Merged
risicle merged 2 commits into
mainfrom
ris-redis-client-flakey-flag
Jun 19, 2026
Merged

RedisClient: add redis_flakey mechanism to avoid repeated timeouts#1361
risicle merged 2 commits into
mainfrom
ris-redis-client-flakey-flag

Conversation

@risicle

@risicle risicle commented May 26, 2026

Copy link
Copy Markdown
Member

https://trello.com/c/PEpdGAPE/1518-implement-solution-for-failed-writes-deletes-to-redis

When connections to redis are timing out, though we can reduce the timeout wait, many requests will attempt to access redis on multiple occasions. in these cases it will end up waiting the timeout period each time. These can add up to make a request fail (e.g. run into an EventletTimeout) where it could otherwise have passed if it had got the hint that redis was in bad shape the first time it got a timeout.

This adds an app-context-local flag redis_flakey that will prevent repeated attempts at accessing redis for calls that
are deemed skippable. skippable means that the consequences of omitting the redis request are not catastrophic and won't cause a consistency problem (just slightly poorer performance).

Call sites can themselves set the skippable argument, but by default gets are considered skippable and sets aren't.

RequestCache.set overrides this to set skippable=True for its RedisClient.set calls because the inner client_method call should be side-effect-free - i.e. nothing has just happened that requires us to invalidate an existing cache entry.

@risicle risicle force-pushed the ris-redis-client-flakey-flag branch from 3464ba8 to ff1013c Compare May 26, 2026 11:08
@risicle risicle requested a review from robinjam May 26, 2026 15:52

@robinjam robinjam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm happy with this approach. Really sorry it took so long to get reviewed...

Happy to re-approve once you've fixed the merge conflicts

@risicle

risicle commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

It's no problem - it had to have proper consideration.

@risicle risicle force-pushed the ris-redis-client-flakey-flag branch from ff1013c to 97bd626 Compare June 19, 2026 09:36
risicle added 2 commits June 19, 2026 11:50
when connections to redis are timing out, though we can reduce
the timeout wait, many requests will attempt to access redis
on multiple occasions. in these cases it will end up wating the
timeout period each time. these can add up to make a request
fail (e.g. run into an `EventletTimeout`) where it could otherwise
have passed if it had got the hint that redis was in bad shape
the first time it got a timeout.

this adds an app-context-local flag `redis_flakey` that will
prevent repeated attempts at accessing redis for calls that
are deemed `skippable`. `skippable` means that the consequences
of omitting the redis request are not catastrophic and won't
cause a consistency problem (just slightly poorer performance).

call sites can themselves set the `skippable` argument, but by
default `get`s are considered skippable and `set`s aren't.

`RequestCache.set` overrides this to set `skippable=True` for its
`RedisClient.set` calls because the inner `client_method` call
*should* be side-effect-free - i.e. nothing has just happened
that requires us to invalidate an existing cache entry.
@risicle risicle force-pushed the ris-redis-client-flakey-flag branch from 97bd626 to 9dd094e Compare June 19, 2026 10:51
@risicle risicle merged commit 6c3744d into main Jun 19, 2026
6 checks passed
@risicle risicle deleted the ris-redis-client-flakey-flag branch June 19, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants