Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content

Resolve "unify redis connector"

guijar_m requested to merge 127-unify-redis-connector into master

Description

Unification of RedisConnector, to not have producer and consumer dichotomy anymore.

ConnectorBase is refactored as well: it is now made of 2 interfaces, one for pub/sub and one for storing values.

The new PubSubInterface has 3 main methods:

  • send(): send a message to listeners
  • register(): same signature as previous consumer, except some unused args have been removed
  • poll_messages(): handle incoming messages before timeout seconds

Each Connector has to implement the methods to be as efficient as possible.

Related Issues

Improvements of RedisConnector

The way to wait for messages, in a loop with a short sleep time, can be improved by blocking on the socket read. get_message calls in a loop with a timeout on socket does the trick.

In addition, message reception and message handling are now separated, each within its own thread. A thread-safe FIFO makes the link between the two tasks. This ensures the best performance for receiving messages, and treatment depends then on the code executed by callbacks.

Callbacks are stored using louie.safe_ref: this ensures an object is not retained by our dispatching code, since it is stored internally as a weak reference.

Removal of catch_connection_error

Previously the catch_connection_error decorator was displaying a message, and swallowing connection errors when talking to Redis. The new code removes this decorator, this makes error management more explicit ; parts of the code are changed accordingly, to react in case of disconnect/reconnect.

Type of Change

  • refactoring BREAKING CHANGES

Closes #127 (closed)

Edited by guijar_m

Merge request reports