Throttle send rate

This commit is contained in:
M66B 2018-11-21 08:01:51 +01:00
parent a69123fc55
commit 285016124e
1 changed files with 8 additions and 0 deletions

View File

@ -138,6 +138,7 @@ public class ServiceSynchronize extends LifecycleService {
private static final long RECONNECT_BACKOFF = 60 * 1000L; // milliseconds
private static final int PREVIEW_SIZE = 250;
private static final int ACCOUNT_ERROR_AFTER = 60; // minutes
private static final int SEND_WAIT = 90; // seconds
static final int PI_WHY = 1;
static final int PI_CLEAR = 2;
@ -1557,6 +1558,13 @@ public class ServiceSynchronize extends LifecycleService {
}
EntityOperation.process(this);
// Throttle send rate
try {
Thread.sleep(SEND_WAIT * 60 * 1000L);
} catch (InterruptedException ignored) {
}
} catch (MessagingException ex) {
db.identity().setIdentityError(ident.id, Helper.formatThrowable(ex));