Last week we migrated our app to Ruby 3.2.2 and Rails 7.0.4.3. Since then, we've started getting errors when executing any commands that need to access Redis. This issue only occurs in production. The app is on Heroku, and it's running the latest version of Redis available, 7.0.11.
It seems like Rails is losing connection with Redis, it fails on the first try, but if you try again, it passes.
However, if you run it again after a few minutes (5 maybe?) without running anything, it'll fail again and then pass on the next try.
Does anyone have an idea on how to solve it?
I tried to use rescue on the places where we are reading/writing to the cache, but it's not working.