Skip to content

Commit

Permalink
refactored carina command executor to handle WDE
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelendik committed Nov 26, 2021
1 parent d82e24e commit 85f7b50
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,23 @@ public CarinaCommandExecutor(URL addressOfRemoteServer) {
@Override
public Response execute(Command command) throws IOException {
Response response = null;
boolean isContinue = true;
int retry = 10; //max attempts to repeit
Number pause = Configuration.getInt(Parameter.EXPLICIT_TIMEOUT) / retry;
while (retry > 0 && isContinue) {
try {
response = super.execute(command);
isContinue = false;
} catch (WebDriverException e) {
//TODO: remove after debugging the issue
e.printStackTrace();
LOGGER.error("Temp CarinaCommandExecutor catched: ", e);

String msg = e.getMessage();
while (retry > 0) {
response = super.execute(command);
if (response.getValue() instanceof WebDriverException) {
LOGGER.error("Temp CarinaCommandExecutor catched: " + response.getValue().toString());
String msg = response.getValue().toString();
if (msg.contains(SpecialKeywords.DRIVER_CONNECTION_REFUSED)
|| msg.contains(SpecialKeywords.DRIVER_CONNECTION_REFUSED2)) {
LOGGER.warn("Enabled command executor retries: " + msg);
CommonUtils.pause(pause);
} else {
throw e;
}
} finally {
retry--;
} else {
// do nothing as response already contains all the information we need
break;
}
retry--;
}

return response;
Expand Down

0 comments on commit 85f7b50

Please sign in to comment.