Skip to content

Commit

Permalink
Merge pull request #52 from nlnwa/maeb-patch-1
Browse files Browse the repository at this point in the history
Fix offset calculation in NextUriScript.java
  • Loading branch information
johnerikhalse authored Nov 17, 2021
2 parents 866c7ca + 6f7423e commit bb99a51
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 bb99a51

Please sign in to comment.