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
Calling RedisModule_Call using ctx with fake client #5384
Comments
Hello @MeirShpilraien, the reason why you see NULL returned is because calling a blocking command via RedisModule_Call() is invalid. What is your goal? You may probably use the key notification API in order to perform certain operations only when some key received a write. |
Hey, |
@antirez we're trying to build a generic module that calls RedisModule_Call according to the user input. |
Understood: the module Call() interface is synchronous, there is no way to make it async: you can traslate the async call to its sync counterpart (like BRPOP -> RPOP), and if it returns no elements register an event or alike, or return an error to the user. |
@antirez I don't see how it can be done especially in case where module command called is using the new Cluster Messaging API and has to wait for other shards to response. |
Duplicate of #7992 |
We are trying to create a module that works on oss cluster. The module send some commands to invoke on all the servers and then perform some aggregations to the results. We decided to use the experimental cluster api to send the commands to all the server and invoke them using RedisModule_Call.
The issue is that on RedisModuleClusterMessageReceiver callback we only have a RedisModuleCtx with a fake client and the command we are trying to invoke is blocking the client (RedisModule_BlockClient), So we ends up receiving a NULL reply (and I am not even sure its ok to call a command that blocks the client via RedisModule_Call with a fake client ctx).
Is there a way to use RedisModule_Call asynchronously by passing a callback to be called when the command is done?
Any other idea how to deal with this issue?
The text was updated successfully, but these errors were encountered: