Skip to content

Commit

Permalink
Gain performance by using experimental waitFor
Browse files Browse the repository at this point in the history
  • Loading branch information
eknoes authored and ra1u committed Aug 10, 2019
1 parent 950d9b9 commit 57fe1d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/redis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

library redis;

import 'dart:cli';
import 'dart:io';
import 'dart:async';
import 'dart:convert';
import 'dart:collection';
import 'dart:math';

part './redisserialise.dart';
part './connection.dart';
Expand Down
6 changes: 2 additions & 4 deletions lib/redisparser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class RedisParser{
.then((list) {
//takeWile consumed CR from stream,
//now check for LF
int size = list.length;
return s.take_n(1).then((lf){
if(lf[0] != LF){
throw("received element is not LF");
Expand All @@ -61,8 +60,7 @@ class RedisParser{
}

static Future parseredisresponse(LazyStream s) {
return s.take_n(1)
.then((list) async {
return s.take_n(1).then((list) {
int cmd = list[0];
switch(cmd){
case TYPE_SS:
Expand All @@ -74,7 +72,7 @@ class RedisParser{
case TYPE_BULK:
return parseBulk(s);
case TYPE_ERROR:
throw await parseError(s);
throw waitFor(parseError(s));
default:
throw("got element that cant not be parsed");
}
Expand Down

0 comments on commit 57fe1d7

Please sign in to comment.