dice icon indicating copy to clipboard operation
dice copied to clipboard

Adds support for SMEMBERS.WATCH command

Open superiorsd10 opened this issue 3 months ago • 1 comments

This PR implements the feature described in the issue #1132. The new SMEMBERS.WATCH command allows subscribed clients to receive push responses whenever the data in a respective set is modified.


Changed Introduced

  • Modified the evalSADD function
  • Added command constants
  • Updated command watch manager
  • Defined metadata for SMEMBERS.WATCH
  • Added integration tests

Why did I modified the evalSADD function

I have had to modify this function because the subscribers were receiving double notifications for the first SADD command. The old implementation caused double notifications because it performed a store.PUT for the initial set creation and subsequent additions. The new implementation defers the store.PUT operation until all additions are complete, ensuring subscribers are notified only once.

Why Sorting the Results in Integration Tests Is Necessary

To validate the correctness of the reactive system, we care about the contents and not the order of the set. Sorting both the expected and received results allows us to

  • Ignore the effects of the asynchronous delivery.
  • Focus solely on whether the correct data was transmitted.

Screenshot

SCR-20241116-q7s

superiorsd10 avatar Nov 16 '24 14:11 superiorsd10