Skip to content

Commit

Permalink
DEV: Drop enable_long_polling and long_polling_interval settings (d…
Browse files Browse the repository at this point in the history
…iscourse#16323)

Scheduled to drop in 2.9.

Co-authored-by: Loïc Guitaut <[email protected]>
  • Loading branch information
tgxworld and Flink authored Mar 30, 2022
1 parent b8828d4 commit d0c2eb3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const ORIGINAL_SETTINGS = {
allow_profile_backgrounds: true,
allow_uploaded_avatars: "0",
tl1_requires_read_posts: 30,
enable_long_polling: true,
polling_interval: 3000,
anon_polling_interval: 30000,
flush_timings_secs: 5,
Expand Down
12 changes: 2 additions & 10 deletions config/initializers/004-message_bus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,8 @@ def setup_message_bus_env(env)

MessageBus.backend_instance.max_backlog_size = GlobalSetting.message_bus_max_backlog_size
MessageBus.backend_instance.clear_every = GlobalSetting.message_bus_clear_every

if SiteSetting.table_exists? && SiteSetting.where(name: ['enable_long_polling', 'long_polling_interval']).exists?
Discourse.deprecate("enable_long_polling/long_polling_interval have switched from site settings to global settings. Remove the override from the Site Settings UI, and use a config file or environment variables to set the global settings.", drop_from: '2.9.0')

MessageBus.long_polling_enabled = SiteSetting.enable_long_polling
MessageBus.long_polling_interval = SiteSetting.long_polling_interval
else
MessageBus.long_polling_enabled = GlobalSetting.enable_long_polling.nil? ? true : GlobalSetting.enable_long_polling
MessageBus.long_polling_interval = GlobalSetting.long_polling_interval || 25000
end
MessageBus.long_polling_enabled = GlobalSetting.enable_long_polling.nil? ? true : GlobalSetting.enable_long_polling
MessageBus.long_polling_interval = GlobalSetting.long_polling_interval || 25000

if Rails.env == "test" || $0 =~ /rake$/
# disable keepalive in testing
Expand Down
2 changes: 0 additions & 2 deletions config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1574,10 +1574,8 @@ en:

enable_personal_messages: "Allow trust level 1 (configurable via min trust to send messages) users to create messages and reply to messages. Note that staff can always send messages no matter what."
enable_system_message_replies: "Allows users to reply to system messages, even if personal messages are disabled"
enable_long_polling: "Message bus used for notification can use long polling"
enable_chunked_encoding: "Enable chunked encoding responses by the server. This feature works on most setups however some proxies may buffer, causing responses to be delayed"
long_polling_base_url: "Base URL used for long polling (when a CDN is serving dynamic content, be sure to set this to origin pull) eg: http://origin.site.com"
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)"
Expand Down
8 changes: 0 additions & 8 deletions config/site_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1883,18 +1883,10 @@ developer:
port:
hidden: true
default: ""
enable_long_polling:
hidden: true
client: true
default: true
enable_chunked_encoding:
hidden: true
client: true
default: true
long_polling_interval:
hidden: true
default: 25000
max: 25000
long_polling_base_url:
hidden: true
client: true
Expand Down
12 changes: 12 additions & 0 deletions db/migrate/20220323141645_remove_polling_site_settings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class RemovePollingSiteSettings < ActiveRecord::Migration[6.1]
def up
execute "DELETE FROM site_settings WHERE name = 'enable_long_polling'"
execute "DELETE FROM site_settings WHERE name = 'long_polling_interval'"
end

def down
raise ActiveRecord::IrreversibleMigration
end
end

0 comments on commit d0c2eb3

Please sign in to comment.