Skip to content

Commit

Permalink
Close scanner when reached max_results.
Browse files Browse the repository at this point in the history
When the suggest scanner has reached max_results, close the scanner.

This requires upstream fix for asynchbase for 0.96+:
OpenTSDB/asynchbase#91
  • Loading branch information
Philip K. Warren authored and manolama committed Nov 9, 2014
1 parent dab7ddd commit a802c19
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/uid/UniqueId.java
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,12 @@ public Object call(final ArrayList<ArrayList<KeyValue>> rows) {
}
suggestions.add(name);
if ((short) suggestions.size() >= max_results) { // We have enough.
return suggestions;
return scanner.close().addCallback(new Callback<Object, Object>() {
@Override
public Object call(Object ignored) throws Exception {
return suggestions;
}
});
}
row.clear(); // free()
}
Expand Down Expand Up @@ -1153,4 +1158,4 @@ public Map<String, Long> call(final ArrayList<KeyValue> row)
get.qualifiers(kinds);
return tsdb.getClient().get(get).addCallback(new GetCB());
}
}
}

0 comments on commit a802c19

Please sign in to comment.