(fix) set minimal interval (fixes #3605)
This commit is contained in:
parent
f2086b76c7
commit
afc4552cb0
|
@ -1842,7 +1842,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
NSArray *allCollections;
|
NSArray *allCollections;
|
||||||
NSData *d;
|
NSData *d;
|
||||||
|
|
||||||
int i, j, defaultInterval, heartbeatInterval, internalInterval, maxSyncResponseSize, total_sleep;
|
int i, j, defaultInterval, heartbeatInterval, internalInterval, maxSyncResponseSize, total_sleep, sleepInterval;
|
||||||
BOOL changeDetected;
|
BOOL changeDetected;
|
||||||
|
|
||||||
// We initialize our output buffer
|
// We initialize our output buffer
|
||||||
|
@ -1879,6 +1879,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
maxSyncResponseSize = [[SOGoSystemDefaults sharedSystemDefaults] maximumSyncResponseSize];
|
maxSyncResponseSize = [[SOGoSystemDefaults sharedSystemDefaults] maximumSyncResponseSize];
|
||||||
heartbeatInterval = [[[(id)[theDocumentElement getElementsByTagName: @"HeartbeatInterval"] lastObject] textValue] intValue];
|
heartbeatInterval = [[[(id)[theDocumentElement getElementsByTagName: @"HeartbeatInterval"] lastObject] textValue] intValue];
|
||||||
internalInterval = [defaults internalSyncInterval];
|
internalInterval = [defaults internalSyncInterval];
|
||||||
|
sleepInterval = (internalInterval < 5) ? internalInterval : 5;
|
||||||
|
|
||||||
// If the request doesn't contain "HeartbeatInterval" there is no reason to delay the response.
|
// If the request doesn't contain "HeartbeatInterval" there is no reason to delay the response.
|
||||||
if (heartbeatInterval == 0)
|
if (heartbeatInterval == 0)
|
||||||
|
@ -1965,8 +1966,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logWithFormat: @"Sleeping %d seconds while detecting changes in Sync...", internalInterval-total_sleep];
|
[self logWithFormat: @"Sleeping %d seconds while detecting changes in Sync...", internalInterval-total_sleep];
|
||||||
sleep(5);
|
sleep(sleepInterval);
|
||||||
total_sleep += 5;
|
total_sleep += sleepInterval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2041,7 +2041,7 @@ void handle_terminate(int signum)
|
||||||
NSData *d;
|
NSData *d;
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
int i, j, heartbeatInterval, defaultInterval, internalInterval, status, total_sleep;
|
int i, j, heartbeatInterval, defaultInterval, internalInterval, status, total_sleep, sleepInterval;
|
||||||
|
|
||||||
// Let other ping requests know that a new request has arrived.
|
// Let other ping requests know that a new request has arrived.
|
||||||
processIdentifier = [NSString stringWithFormat: @"%d", [[NSProcessInfo processInfo] processIdentifier]];
|
processIdentifier = [NSString stringWithFormat: @"%d", [[NSProcessInfo processInfo] processIdentifier]];
|
||||||
|
@ -2055,6 +2055,7 @@ void handle_terminate(int signum)
|
||||||
defaults = [SOGoSystemDefaults sharedSystemDefaults];
|
defaults = [SOGoSystemDefaults sharedSystemDefaults];
|
||||||
defaultInterval = [defaults maximumPingInterval];
|
defaultInterval = [defaults maximumPingInterval];
|
||||||
internalInterval = [defaults internalSyncInterval];
|
internalInterval = [defaults internalSyncInterval];
|
||||||
|
sleepInterval = (internalInterval < 5) ? internalInterval : 5;
|
||||||
|
|
||||||
if (theDocumentElement)
|
if (theDocumentElement)
|
||||||
heartbeatInterval = [[[(id)[theDocumentElement getElementsByTagName: @"HeartbeatInterval"] lastObject] textValue] intValue];
|
heartbeatInterval = [[[(id)[theDocumentElement getElementsByTagName: @"HeartbeatInterval"] lastObject] textValue] intValue];
|
||||||
|
@ -2168,8 +2169,8 @@ void handle_terminate(int signum)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self logWithFormat: @"Sleeping %d seconds while detecting changes in Ping...", internalInterval-total_sleep];
|
[self logWithFormat: @"Sleeping %d seconds while detecting changes in Ping...", internalInterval-total_sleep];
|
||||||
sleep(5);
|
sleep(sleepInterval);
|
||||||
total_sleep += 5;
|
total_sleep += sleepInterval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue