JonathanGarro / SIMS-Portal

IFRC Surge Information Management Support Portal
4 stars 4 forks source link

Slack API user list rate limit #50

Closed JonathanGarro closed 1 year ago

JonathanGarro commented 1 year ago

The read.users endpoint on the Slack API only allows you to ping it once per minute, which can cause problems when multiple people are signing up at once as that call is necessary for validating that they are a SIMS member.

Propose looking into a Redis layer to cache that list in order to avoid multiple calls.

JonathanGarro commented 1 year ago

Added flask-cache library and set the caching to simple for in-memory storage. The cache gets instantiated inside __init__.py and then imported into any relevant utility files. Decorate the necessary functions with cache.cached(timeout=X), replacing X with an int representing the number of seconds to store the value.

Implemented for 1.2.0 release.