openverse-api icon indicating copy to clipboard operation
openverse-api copied to clipboard

Remove transition code in search controller

Open dhruvkb opened this issue 3 years ago • 2 comments

Problem

The code described in this snippet was transitionary and has served its utility. It should be removed. https://github.com/WordPress/openverse-api/blob/6cc0551c639081f895d974b30cc465713d0ce360/api/catalog/api/controllers/search_controller.py#L379-L387

Description

This cache invalidation snippet has definitely run in production and the caches have surely been migrated to the new format. This should no longer be a part of the codebase.

Alternatives

Even in the highly unlikely event that the caches have not been cleared and updated, a better solution would be to use try...except to handle invalid values rather than using a very specific transition state.

Implementation

  • [ ] 🙋 I would be interested in implementing this feature.

dhruvkb avatar May 16 '22 13:05 dhruvkb

Can we check the production cache to confirm this is safe?

sarayourfriend avatar May 19 '22 12:05 sarayourfriend

@sarayourfriend given how long this has existed in the code, it's safe to assume this code has executed at least once, but yeah we can check the cache once and verify.

dhruvkb avatar May 19 '22 19:05 dhruvkb