adium/adium

Parents 6c2293048ca9
Children 785d5ffb92f6
When Twitter disconnects, don't try to reconnect unless 15 minutes have passed, instead of 5 seconds. If we exceed a rate limit, we would continue to do that.
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.h Tue Sep 03 10:23:40 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.h Sun Sep 08 00:01:49 2013 +0200
@@ -100,6 +100,7 @@
//FUS Disconnecting
- (void)autoReconnectAfterDelay:(NSTimeInterval)delay;
+- (double)minimumReconnectTime;
- (void)cancelAutoReconnect;
- (void)initFUSDisconnecting;
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.m Tue Sep 03 10:23:40 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.m Sun Sep 08 00:01:49 2013 +0200
@@ -1332,6 +1332,11 @@
return _contactProperties;
}
+- (double)minimumReconnectTime
+{
+ return RECONNECT_MIN_TIME;
+}
+
/*!
* @brief Did disconnect
*/
@@ -1388,8 +1393,8 @@
double reconnectDelay = pow(RECONNECT_BASE_TIME, (double)reconnectAttemptsPerformed);
// Make sure we're not going too fast
- if (reconnectDelay < RECONNECT_MIN_TIME)
- reconnectDelay = RECONNECT_MIN_TIME;
+ if (reconnectDelay < [self minimumReconnectTime])
+ reconnectDelay = [self minimumReconnectTime];
// Or too slow
else if (reconnectDelay > RECONNECT_MAX_TIME)
reconnectDelay = RECONNECT_MAX_TIME;
--- a/Plugins/Twitter Plugin/AITwitterAccount.m Tue Sep 03 10:23:40 2013 +0200
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Sun Sep 08 00:01:49 2013 +0200
@@ -290,6 +290,15 @@
}
/*!
+ * @brief A disconnect on Twitter often means we broke some rate-limit, or the server is overloaded.
+ * Lets be polite and wait for 15 minutes.
+ */
+- (double)minimumReconnectTime
+{
+ return 15.0 * 60.0;
+}
+
+/*!
* @brief Session ended
*
* Remove all state information.