Closed eknoes closed 5 years ago
This looks fine for me. It seems that such behavior is expected according to protocol specs.
Can we get one functional test for this feature?
I can do that, but I don't really have an idea how. As the Future
When its returned and thrown I don't have an Idea how to write a test.
BTW: That do you think about using darts test framework? Then, it would be easier with expectLater(fn, throwsArgumentError)
Thank you for your input.
I think there are few spots to fix synchronous error leaking in library and this PR shows some of current issues with current library. Looking for ideas how to fix synchronous error handling.
I wrote a test and fixed the synchronous error leak.
It looks like that performance decreased since v1.1.0 . Can you please compare results between this patch/master and tag v1.1.0 also on your side.
My results:
current master paralel (100 connecetions) 139179 ops/s raw performance 139179 ops/s
tag v1.1.0 paralel (100 connecetions) 165426 ops/s raw performance 174064 ops/s
I can confirm this :(
current master: parallel(100 connections) with 200000 73341 ops/s raw performance with 200000 74710 ops/s
tag v1.1.0: parallel(100 connections) with 200000 90950 ops/s raw performance with 200000 101781 ops/s
Looks like performance issues with async are known: https://github.com/dart-lang/sdk/issues/29189
There is an experimental dart function that we could use that should speed up performance: waitFor. Can you confirm, that this has higher performance: https://github.com/eknoes/redis-dart/tree/experimental-performance
This works better, but I do not clearly understand how and where changed invariant effects library usage. It have feeling that it should be fine in most cases.
I think everything works normal, but when an error received it does not return a future, but its more like a:
Future = parseError(stream)
while(Future.notFinished) {
sleep()
}
throw Error();
So your synchronous program is just slower when you will receive an error, otherwise its a lot more performant. For the use cases I can imagine this is better than "everytime a bit slower".
So I would make a PR, okay?
What do you think about throwing errors received from Redis? Otherwise, one has to check the Futures wether they returned an error or the expected data. In my opinion, throwing them directly would be the better way.