Don't declare connection unusable too quickly.

This commit is contained in:
Johannes Mockenhaupt 2017-12-20 10:33:03 +01:00
parent 181338e9e2
commit ea1fd8fee8
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -187,10 +187,10 @@ public class RuffyScripter implements RuffyCommands {
if (!ruffyService.isConnected()) { if (!ruffyService.isConnected()) {
return false; return false;
} }
if (System.currentTimeMillis() - menuLastUpdated >= 500) { if (System.currentTimeMillis() - menuLastUpdated >= 1500) {
waitForScreenUpdate(); waitForScreenUpdate();
} }
return System.currentTimeMillis() - menuLastUpdated < 500; return System.currentTimeMillis() - menuLastUpdated < 1500;
} catch (RemoteException e) { } catch (RemoteException e) {
return false; return false;
} }
@ -282,7 +282,9 @@ public class RuffyScripter implements RuffyCommands {
// on connection loss try to reconnect, confirm warning alerts caused by // on connection loss try to reconnect, confirm warning alerts caused by
// the disconnected and then return the command as failed (the caller // the disconnected and then return the command as failed (the caller
// can retry if needed). // can retry if needed).
log.debug("Connection unusable, aborting command and attempting reconnect ..."); log.debug("Connection unusable (ruffy connection: " + ruffyService.isConnected() + ", "
+ "time since last menu update: " + (System.currentTimeMillis() - menuLastUpdated) + " ms, "
+ "aborting command and attempting reconnect ...");
cmdThread.interrupt(); cmdThread.interrupt();
activeCmd.getResult().success = false; activeCmd.getResult().success = false;