Skip to content

Add a RedisProvider class

Jeremy Devenport requested to merge jdevenport/redis-provider-refactor into master

Description

This MR adds a RedisProvider class that manages the connection to redis (either a single server or multiple servers managed with Redis Sentinel) and provides a small abstraction for retrying operations when a Sentinel managed server disconnects or times out.

Changes proposed in this merge request:

  • Add the RedisProvider class
  • RedisActionCache and RedisStorage constructors modified to take a RedisProvider instead of individual redis connection arguments
  • RedisActionCache and RedisStorage refactored to use the RedisProvider interface which simplifies interacting with sentinel managed interfaces
  • Fixes a bug where the db and password options were not used when connecting with a sentinel

Config file changes

  • Adds a !redis-connection tag for configuring redis connection information in the connections section of a config.
  • Updates !redis-storage and !redis-action-cache to add a redis argument that specifies a !redis-connection rather than specifying the connection information directly. The old arguments are still accepted, with a warning, for now.

Validation

Run a BuildGrid instance with both standalone and Sentinel-managed redis servers. Verify that redis commands are sent to the correct (master/replica) instance.

Edited by Jeremy Devenport

Merge request reports