-
Notifications
You must be signed in to change notification settings - Fork 986
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
Use channel thread to enqueue commands #617
Comments
Too me it is more a like bug. I want invoke Lettuce CompletableFuture API and not to worry of caller thread being locked or catch an exception. Is thrown in caller thread even though CompleteableFuture API is used.
|
Any validation happens beforehand to fail fast. It does not make sense to accept a command and reject it later if the validation can happen early. |
Yes, fail-fast is good, but it should be wrapped in RedisFuture, then I handle it in CompletableFuture. |
Otherwise I have to handle exceptions in CompletableFuture and in caller thread. And getting exception in caller thread is counterintuitive. |
There's a point in handling failures inside the callbacks. Thanks a lot for your feedback. I'd argue that you nevertheless need to handle errors in your call chain anyway – exceptions can happen due to other reasons before the actual command was constructed and dispatched (e.g. argument validation, infrastructure failures). |
As API user I would never prefer to get exceptions in caller thread. All other exceptions could be caught or wrapped by the API implementation and return as CompletableFuture. |
We refactored how exception signals are propagated into RedisCommand objects if a command is not eligible for being written to Redis. Previously, we relied on |
…ures #617 Exceptions that were used to signal a full queue or prohibited commands are now no longer thrown but used to complete a command exceptionally. This approach friendlier to users of asynchronous/reactive APIs as the command outcome aligns with the programming model for error handling.
Using the channel thread to write the command makes a lot of sense because we could probably get rid of some synchronization code and subsequent channel I/O does not require further context switching. It would also unblock writes because we don't require synchronization to perform the actual channel write.
The text was updated successfully, but these errors were encountered: