Better multi/exec results (suggestion)?
See original GitHub issueHello.
As for versions 1.x and 2.x-rc transaction multi/exec results are
returned in [Error, [Error1, Value1], ... ]
format. With promised
based API it looks very confusing, for example:
ioredis.multi().get('key1').get('key2').exec()
.spread( ([e1, val1], [e2, val2]) => {
/* NO ERRORS(?) */
})
.catch(e => {
/* ERROR HANDLING */
});
It is unclear what should e1
and e2
mean in this context. As far
as i understand, partially applied transaction should happen only when
arguments count is wrong, or command is used on a wrong value type. So
such errors should never occur when redis is used correctly. Will it
be better to have something like this?
ioredis.multi().get('key1').get('key2').exec()
.spread( (val1, val2) => {
/* NO ERRORS */
})
.catch(e => {
/* ERROR HANDLING, e may have a field with transaction results
* like this [ [Error1, Value1], ... ] */
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Which Redis commands make sense inside of Multi - Exec?
I'm writing a PHP 5 wrapper class to the Owlient PhpRedis PHP C extension, because, for example some commands in my application record...
Read more >Interleaving Watch Multi/exec on a single Redis connection ...
To answer my own question: This is expected behavior. The first exec unwatches all properties. Therefore, the second multi/exec goes through without ...
Read more >Feedback - WinSSHTerm
I have been trying WinSSHterm for awhile and it's a good product. I like to know if you can add few more updates...
Read more >Pipelines — redis-py-cluster 2.1.3 documentation
Suggestion two¶ ... Current pipeline implementation. This implementation is rather good and works well because it combines the existing pipeline interface and ...
Read more >curl_multi_exec - Manual - PHP
Solve CPU 100% usage, a more simple and right way: <?php ... run curl multi exec in background while fiber is in suspend...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 7 days if no further activity occurs, but feel free to re-open a closed issue if needed.
I would also like to see a better transaction result format for the promise-based API.
What do you think about introducing a custom error type, e.g.
PartiallyAppliedTransactionError
which could have additional fields that point exactly to the commands that have been applied or failed, for example: