dice
dice copied to clipboard
Adds support for SMEMBERS.WATCH command
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.