-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add finalizer support in async API #1173
Open
zuiderkwast
wants to merge
12
commits into
redis:master
Choose a base branch
from
zuiderkwast:finalizer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Commits on Jul 19, 2023
-
Rewrite async callback queue (push/shift) to not do allocations
The callback queue in the changed so that each callback is allocated once and freed once. The operations "push" and "shift" don't copy the callback struct between heap and stack, but instead they and just set the 'next' pointer to link callbacks into a list, without doing any allocations. For pubsub channels, one callback can be mapped to multiple channels, and they can be unsubscribed independently, so we use a reference counter to keep track of references to a callback. This prepares for adding finalizer support and to be sure it is called only once, when the callback is freed. The way hiredis kept tack of 'pubsub mode' using `pending_subs` and `unsubscribe_sent` was flawed. It couldn't handle multiple pending subscribe commands with an overlapping but different set of channels and it couldn't handle an error reply to a SUBSCRIBE or UNSUBSCRIBE command. Now we change this so that all commands, even SUBSCRIBE and UNSUBSCRIBE, are added to the reply queue and the 'subscribe' and 'unsubscribe' replies are matched against them in the queue. The channel-to-callback dicts are updated when a 'subscribe' or 'unsubscribe' reply is received, confirming that the client has subscribed or unsubscribed to a channel, rather than when the command is sent. This change makes it possible to handle an error reply for a pubsub command. With this change, there is no need to keep a different replies queue for subscribe commands and regular commands. All are added to the same replies queue.
Configuration menu - View commit details
-
Copy full SHA for 342cb92 - Browse repository at this point
Copy the full SHA 342cb92View commit details -
Add finalizer support to async Redis client
* For each time redisAsyncCommandWithFinalizer or one of its variants has been called with a finalizer, the finalizer will be called exactly once. * The finalizer is called when a callback (even if the callback function is NULL) is no longer associated with any command or pubsub channel or pattern. * The finalizer is called after the last call to the callback. The callback is never called after the finalizer has been called. New async API functions added: * redisvAsyncCommandWithFinalizer * redisAsyncCommandWithFinalizer * redisAsyncCommandArgvWithFinalizer * redisAsyncFormattedCommandWithFinalizer Co-Authored-By: Tudor Bosman <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1dff7b4 - Browse repository at this point
Copy the full SHA 1dff7b4View commit details -
Co-Authored-By: Tudor Bosman <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5468136 - Browse repository at this point
Copy the full SHA 5468136View commit details
Commits on Jul 20, 2023
-
Implement RESET in async API: Cancel subscriptions and monitor mode
Additionally, accept commands in monitor mode. (For example the RESET command, but also other commands.) Apart from being useful but itself, this change makes the async API's reply queue stay in sync (mapping each reply to the callback given when the command was sent) when bombed with random commands (fuzzing).
Configuration menu - View commit details
-
Copy full SHA for 41cf219 - Browse repository at this point
Copy the full SHA 41cf219View commit details
Commits on Jul 21, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 17c391b - Browse repository at this point
Copy the full SHA 17c391bView commit details -
Configuration menu - View commit details
-
Copy full SHA for cbe49dd - Browse repository at this point
Copy the full SHA cbe49ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7081c21 - Browse repository at this point
Copy the full SHA 7081c21View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f8a1bb - Browse repository at this point
Copy the full SHA 7f8a1bbView commit details
Commits on Aug 23, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 63968e9 - Browse repository at this point
Copy the full SHA 63968e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for cb6fbbf - Browse repository at this point
Copy the full SHA cb6fbbfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 401053a - Browse repository at this point
Copy the full SHA 401053aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 27d36f4 - Browse repository at this point
Copy the full SHA 27d36f4View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.