diff --git a/Gemfile.lock b/Gemfile.lock index afdaad36d80..0673cfb167b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,7 +163,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) memory_profiler (0.0.4) - message_bus (0.9.6) + message_bus (1.0.0) eventmachine rack (>= 1.1.3) redis diff --git a/app/assets/javascripts/discourse/initializers/subscribe-user-notifications.js.es6 b/app/assets/javascripts/discourse/initializers/subscribe-user-notifications.js.es6 index f8aaac79199..0104f6b2ddf 100644 --- a/app/assets/javascripts/discourse/initializers/subscribe-user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/initializers/subscribe-user-notifications.js.es6 @@ -10,8 +10,11 @@ export default { var site = container.lookup('site:main'), siteSettings = container.lookup('site-settings:main'); + var bus = Discourse.MessageBus; + bus.callbackInterval = siteSettings.anon_polling_interval; + bus.backgroundCallbackInterval = siteSettings.background_polling_interval; + if (user) { - var bus = Discourse.MessageBus; bus.callbackInterval = siteSettings.polling_interval; bus.enableLongPolling = true; bus.baseUrl = Discourse.getURL("/"); diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 6424975f16a..df85e0096c5 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -698,9 +698,10 @@ en: 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" - long_polling_interval: "Interval before a new long poll is issued in milliseconds " - polling_interval: "How often should logged in user clients poll 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: "When not long polling, how often should logged on 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)" new_topic_duration_minutes: "Global default number of minutes a topic is considered new, users can override (-1 for always, -2 for last visit)" diff --git a/config/site_settings.yml b/config/site_settings.yml index 525a68b3693..a9892adf152 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -615,13 +615,16 @@ developer: enable_long_polling: client: true default: true - long_polling_interval: 15000 + long_polling_interval: 25000 + background_polling_interval: + client: true + default: 60000 polling_interval: client: true default: 3000 anon_polling_interval: client: true - default: 30000 + default: 15000 flush_timings_secs: client: true default: 5