Skip to content

Update HeartBeatTask.java #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/main/java/ua/naiksoftware/stomp/HeartBeatTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void checkServerHeartBeat() {
if (serverHeartbeat > 0) {
final long now = System.currentTimeMillis();
//use a forgiving boundary as some heart beats can be delayed or lost.
final long boundary = now - (3 * serverHeartbeat);
final long boundary = now - (1 * serverHeartbeat);
//we need to check because the task could failed to abort
if (lastServerHeartBeat < boundary) {
Log.d(TAG, "It's a sad day ;( Server didn't send heart-beat on time. Last received at '" + lastServerHeartBeat + "' and now is '" + now + "'");
Expand All @@ -149,8 +149,8 @@ private void checkServerHeartBeat() {
}
} else {
Log.d(TAG, "We were checking and server sent heart-beat on time. So well-behaved :)");
lastServerHeartBeat = System.currentTimeMillis();
}
this.scheduleServerHeartBeatCheck();
}
}

Expand Down