Skip to content

Commit

Permalink
Tesla : reset the Even Stream connection to the Tesla Back-end if the…
Browse files Browse the repository at this point in the history
… event time stamps differ too much from the current system time (openhab#2358)

Signed-off-by: Karel Goderis <[email protected]>
  • Loading branch information
kgoderis authored and falkena committed Jun 29, 2017
1 parent 636bb5d commit f63836a
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class TeslaHandler extends BaseThingHandler {
private static final int EVENT_STREAM_CONNECT_TIMEOUT = 3000;
private static final int EVENT_STREAM_READ_TIMEOUT = 200000;
private static final int EVENT_TIMESTAMP_AGE_LIMIT = 3000;
private static final int EVENT_TIMESTAMP_MAX_DELTA = 10000;
private static final int FAST_STATUS_REFRESH_INTERVAL = 15000;
private static final int SLOW_STATUS_REFRESH_INTERVAL = 60000;
private static final int CONNECT_RETRY_INTERVAL = 15000;
Expand Down Expand Up @@ -1040,6 +1041,12 @@ public void run() {
dateFormatter.format(currentTimeStamp),
dateFormatter.format(systemTimeStamp));
}
if (systemTimeStamp - currentTimeStamp > EVENT_TIMESTAMP_MAX_DELTA) {
if (logger.isTraceEnabled()) {
logger.trace("Event Stream : The event stream will be reset");
}
isEstablished = false;
}
}

line = eventBufferedReader.readLine();
Expand Down

0 comments on commit f63836a

Please sign in to comment.