Skip to content

Commit

Permalink
transaction discard #11
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1u committed Feb 21, 2020
1 parent 8d8e16a commit 3110c8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
21 changes: 7 additions & 14 deletions lib/connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,19 @@ class RedisConnection{
//it just wait something to come from socket
//it parse it and execute future
Future _senddummy(){
Completer completer = new Completer();
_future = _future.then((_) =>
RedisParser.parseredisresponse(_stream)
.then((v) => completer.complete(v))
.catchError((e) {
completer.completeError(e);
})
);
return completer.future;
_future = _future.then((_) {
return RedisParser.parseredisresponse(_stream);
});
return _future;
}

// return future that complets
// when all prevous _future finished
Future _getdummy(){
Completer completer = new Completer.sync();
_future = _future.then((_){
completer.complete("dummy data");
}
);
return completer.future;
return "dummy data";
});
return _future;
}

Future _sendraw(List data){
Expand Down
6 changes: 6 additions & 0 deletions lib/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class Transaction extends Command{
}).catchError((error) => c.completeError(error));
return c.future;
}

Future discard(){
_overrided_command._connection = this._connection;
transaction_completed = true;
return super.send_object(["DISCARD"]);
}

Future exec(){
_overrided_command._connection = this._connection;
Expand Down
4 changes: 2 additions & 2 deletions test/performance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import 'main.dart';

void main() {
testing_performance(
test_muliconnections_con(100), "Multiple connections", 2000000)
test_muliconnections_con(100), "Multiple connections", 200000)
.then(
(_) => testing_performance(test_pubsub_performance, "PubSub", 200000))
.then((_) =>
testing_performance(test_performance, "Raw Performance", 2000000))
testing_performance(test_performance, "Raw Performance", 200000))
.then((_) => test_long_running(200000))
.then((_) => print("Finished Performance Tests"))
.then((_) => exit(0));
Expand Down

0 comments on commit 3110c8e

Please sign in to comment.