notnoop/java-apns — Issue #69: Bug in com.notnoop.apns.internal.ReconnectPolicies
Author: gfzabarino
Created: 2012-03-02 14:38:10+00:00
State: open

Hi everybody, I was using the EveryHalfHour reconnect policy, however I noted that for every notification a new connection is made. Then I saw this:

public boolean shouldReconnect() {
return System.currentTimeMillis() - lastRunning > PERIOD;
}

I think that it should something like this:

public boolean shouldReconnect() {
if (System.currentTimeMillis() - lastRunning > PERIOD) {
lastRunning = System.currentTimeMillis();
return true;
}
return false;
}

right?? the original way is never updating the lastRunning variable, therefore, every time shouldReconnect gets called, it will always return true! Greetings

Gian Franco Zabarino