Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
drallieiv committed Dec 11, 2017
1 parent d86e13a commit 2fc3579
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,5 +367,4 @@ private Request buildBalanceCheckequestGet() throws JsonProcessingException {
.build();
return request;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@

public class ClientProvider extends AntiCaptchaProvider {

private String captchaInUrl = "http://localhost:8888/captcha/in";
private String captchaOutUrl = "http://localhost:8888/captcha/out";
private static final String CAPTCHA_RETRIEIVE_URL = "http://localhost:8888/captcha/retrieive";
private static final String CAPTCHA_SUBMIT_URL = "http://localhost:8888/captcha/submit";
private static final String CAPTCHA_BALANCE_URL = "http://localhost:8888/captcha/balance";

public static CaptchaProvider getInstance(CaptchaQueue queue) throws CaptchaException {
return new ClientProvider(queue);
ClientProvider provider = new ClientProvider(queue);
provider.setCaptchaBalanceUrl(CAPTCHA_BALANCE_URL);
provider.setCaptchaSubmitUrl(CAPTCHA_SUBMIT_URL);
provider.setCaptchaRetrieveUrl(CAPTCHA_RETRIEIVE_URL);
provider.setWaitBeforeRetry(200);
return provider;
}

public ClientProvider(CaptchaQueue queue) throws CaptchaException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void addSolutionToSite(String googleSiteKey, String solution) {
}

public void addSolution(String solution) {
CaptchaJob job = jobs.values().stream().findFirst().orElse(null);
CaptchaJob job = jobs.values().stream().filter(j -> j.getSolution() == null).findFirst().orElse(null);
if (job != null) {
job.setSolution(solution);
}
Expand All @@ -60,7 +60,7 @@ public CaptchaJob getNextJob(){

private Integer nextAvailableJobId() {
log.debug("Get next available counter value");
counter = counter++ % max;
counter = (counter + 1) % max;
return counter;
}
}

0 comments on commit 2fc3579

Please sign in to comment.