Skip to content

Commit

Permalink
Fix offset calculation in NextUriScript.java
Browse files Browse the repository at this point in the history
  • Loading branch information
maeb authored Nov 16, 2021
1 parent 866c7ca commit 6f7423e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public NextUriScriptResult run(JedisContext ctx, CrawlHostGroup crawlHostGroup)
String key = UCHG + chgId;
String minScore = String.valueOf(Math.random() * maxScore);
Long matchCount = jedis.zcount(key, minScore, "+inf");
long offset = (int) (Math.random() * (matchCount - 1));
Set<String> eResult = jedis.zrangeByScore(key, minScore, "+inf", (int) offset, 1);
int offset = (int) (Math.random() * matchCount);
Set<String> eResult = jedis.zrangeByScore(key, minScore, "+inf", offset, 1);
if (eResult.isEmpty()) {
return new NextUriScriptResult(FutureOptional.empty());
}
Expand Down

0 comments on commit 6f7423e

Please sign in to comment.