Back

One of the resource files was causing a n+1 problem. But, due to our business logic, we made a decision not to eager load the relationship. My solution was to save the owner_id of each businesses in a cache.

I wrote tests and they passed without a problem. Existing functionalities worked as expected locally. But, when it was pushed to the production, it caused an issue where the returning value was always false, even when it should have been true.

The issue was that I was using a different cache driver. This was an issue because Redis stores everything as a string value and would not return an integer (which I did not know about).

Lessons learnt:
1. Mirror your production env as closely as possible.
2. Redis stores everything in string.

image
image

79

  • No matching results...
  • Searching...

/ 1000

Poll Options