forked from I2P_Developers/i2p.i2p
* RepublishLeaseSetJob:
- Out-of-order JobQueue 3nd try to fix - Lower timeouts
This commit is contained in:
@ -21,11 +21,12 @@ import net.i2p.util.Log;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RepublishLeaseSetJob extends JobImpl {
|
public class RepublishLeaseSetJob extends JobImpl {
|
||||||
private Log _log;
|
private final Log _log;
|
||||||
private final static long REPUBLISH_LEASESET_DELAY = 5*60*1000;
|
private final static long REPUBLISH_LEASESET_DELAY = 5*60*1000;
|
||||||
public final static long REPUBLISH_LEASESET_TIMEOUT = 90*1000;
|
public final static long REPUBLISH_LEASESET_TIMEOUT = 60*1000;
|
||||||
private Hash _dest;
|
private final static int RETRY_DELAY = 20*1000;
|
||||||
private KademliaNetworkDatabaseFacade _facade;
|
private final Hash _dest;
|
||||||
|
private final KademliaNetworkDatabaseFacade _facade;
|
||||||
/** this is actually last attempted publish */
|
/** this is actually last attempted publish */
|
||||||
private long _lastPublished;
|
private long _lastPublished;
|
||||||
|
|
||||||
@ -34,10 +35,11 @@ public class RepublishLeaseSetJob extends JobImpl {
|
|||||||
_log = ctx.logManager().getLog(RepublishLeaseSetJob.class);
|
_log = ctx.logManager().getLog(RepublishLeaseSetJob.class);
|
||||||
_facade = facade;
|
_facade = facade;
|
||||||
_dest = destHash;
|
_dest = destHash;
|
||||||
_lastPublished = 0;
|
|
||||||
//getTiming().setStartAfter(ctx.clock().now()+REPUBLISH_LEASESET_DELAY);
|
//getTiming().setStartAfter(ctx.clock().now()+REPUBLISH_LEASESET_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() { return "Republish a local leaseSet"; }
|
public String getName() { return "Republish a local leaseSet"; }
|
||||||
|
|
||||||
public void runJob() {
|
public void runJob() {
|
||||||
if (!getContext().clientManager().shouldPublishLeaseSet(_dest))
|
if (!getContext().clientManager().shouldPublishLeaseSet(_dest))
|
||||||
return;
|
return;
|
||||||
@ -61,10 +63,10 @@ public class RepublishLeaseSetJob extends JobImpl {
|
|||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Client " + _dest + " is local, but we can't find a valid LeaseSet? perhaps its being rebuilt?");
|
_log.warn("Client " + _dest + " is local, but we can't find a valid LeaseSet? perhaps its being rebuilt?");
|
||||||
}
|
}
|
||||||
if (false) { // floodfill doesnt require republishing
|
//if (false) { // floodfill doesnt require republishing
|
||||||
long republishDelay = getContext().random().nextLong(2*REPUBLISH_LEASESET_DELAY);
|
// long republishDelay = getContext().random().nextLong(2*REPUBLISH_LEASESET_DELAY);
|
||||||
requeue(republishDelay);
|
// requeue(republishDelay);
|
||||||
}
|
//}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
@ -81,14 +83,16 @@ public class RepublishLeaseSetJob extends JobImpl {
|
|||||||
|
|
||||||
void requeueRepublish() {
|
void requeueRepublish() {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("FAILED publishing of the leaseSet for " + _dest.toBase64());
|
_log.warn("FAILED publishing of the leaseSet for " + _dest);
|
||||||
requeue(getContext().random().nextInt(60*1000));
|
getContext().jobQueue().removeJob(this);
|
||||||
|
requeue(RETRY_DELAY + getContext().random().nextInt(RETRY_DELAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public long lastPublished() {
|
public long lastPublished() {
|
||||||
return _lastPublished;
|
return _lastPublished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** TODO - does nothing, remove */
|
||||||
private static class OnRepublishSuccess extends JobImpl {
|
private static class OnRepublishSuccess extends JobImpl {
|
||||||
public OnRepublishSuccess(RouterContext ctx) { super(ctx); }
|
public OnRepublishSuccess(RouterContext ctx) { super(ctx); }
|
||||||
public String getName() { return "Publish leaseSet successful"; }
|
public String getName() { return "Publish leaseSet successful"; }
|
||||||
|
Reference in New Issue
Block a user