FIX: respect anon_polling_interval

FIX: only poll background message bus pages once a minute
FEATURE: background_polling_interval
FEATURE: long polling pushed back to 25 seconds
FEATURE: force a poll when a bg page returns to foreground

also improve copy of message bus settings a bit
This commit is contained in:
Sam 2014-10-22 12:49:10 +11:00
parent 0e3c06cf61
commit 73486b8ddd
4 changed files with 13 additions and 6 deletions

View File

@ -163,7 +163,7 @@ GEM
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
memory_profiler (0.0.4) memory_profiler (0.0.4)
message_bus (0.9.6) message_bus (1.0.0)
eventmachine eventmachine
rack (>= 1.1.3) rack (>= 1.1.3)
redis redis

View File

@ -10,8 +10,11 @@ export default {
var site = container.lookup('site:main'), var site = container.lookup('site:main'),
siteSettings = container.lookup('site-settings:main'); siteSettings = container.lookup('site-settings:main');
if (user) {
var bus = Discourse.MessageBus; var bus = Discourse.MessageBus;
bus.callbackInterval = siteSettings.anon_polling_interval;
bus.backgroundCallbackInterval = siteSettings.background_polling_interval;
if (user) {
bus.callbackInterval = siteSettings.polling_interval; bus.callbackInterval = siteSettings.polling_interval;
bus.enableLongPolling = true; bus.enableLongPolling = true;
bus.baseUrl = Discourse.getURL("/"); bus.baseUrl = Discourse.getURL("/");

View File

@ -698,9 +698,10 @@ en:
enable_private_messages: "Allow trust level 1 users to create private messages and reply to private messages" enable_private_messages: "Allow trust level 1 users to create private messages and reply to private messages"
enable_long_polling: "Message bus used for notification can use long polling" enable_long_polling: "Message bus used for notification can use long polling"
long_polling_interval: "Interval before a new long poll is issued in milliseconds " long_polling_interval: "Amount of time the server should wait before responding to clients when there is no data to send (logged on users only)"
polling_interval: "How often should logged in user clients poll in milliseconds" polling_interval: "When not long polling, how often should logged on clients poll in milliseconds"
anon_polling_interval: "How often should anonymous clients poll in milliseconds" anon_polling_interval: "How often should anonymous clients poll in milliseconds"
background_polling_interval: "How often should the clients poll in milliseconds (when the window is in the background)"
auto_track_topics_after: "Global default milliseconds before a topic is automatically tracked, users can override (0 for always, -1 for never)" auto_track_topics_after: "Global default milliseconds before a topic is automatically tracked, users can override (0 for always, -1 for never)"
new_topic_duration_minutes: "Global default number of minutes a topic is considered new, users can override (-1 for always, -2 for last visit)" new_topic_duration_minutes: "Global default number of minutes a topic is considered new, users can override (-1 for always, -2 for last visit)"

View File

@ -615,13 +615,16 @@ developer:
enable_long_polling: enable_long_polling:
client: true client: true
default: true default: true
long_polling_interval: 15000 long_polling_interval: 25000
background_polling_interval:
client: true
default: 60000
polling_interval: polling_interval:
client: true client: true
default: 3000 default: 3000
anon_polling_interval: anon_polling_interval:
client: true client: true
default: 30000 default: 15000
flush_timings_secs: flush_timings_secs:
client: true client: true
default: 5 default: 5