A platform for community discussion. Free, open, simple.
PERF: Skip running 'auto_leave' during every PresenceChannel method (#15970)
David Taylore945f301d109
diff --git a/lib/presence_channel.rb b/lib/presence_channel.rbindex 757da7c9912..82c9db540b6 100644--- a/lib/presence_channel.rb+++ b/lib/presence_channel.rb@@ -129,8 +129,6 @@ class PresenceChannelrelease_mutex(mutex_value)endend-- auto_leaveend# Immediately mark a user's client as leaving the channel@@ -151,16 +149,12 @@ class PresenceChannelrelease_mutex(mutex_value)endend-- auto_leaveend# Fetch a {PresenceChannel::State} instance representing the current state of this## @param [Boolean] count_only set true to skip fetching the list of user ids from redisdef state(count_only: config.count_only)- auto_leave-if count_onlylast_id, count = retry_on_mutex_error doPresenceChannel.redis_eval(diff --git a/spec/components/presence_channel_spec.rb b/spec/components/presence_channel_spec.rbindex 1508f790146..09996c567af 100644--- a/spec/components/presence_channel_spec.rb+++ b/spec/components/presence_channel_spec.rb@@ -74,6 +74,8 @@ describe PresenceChannel dofreeze_time Time.zone.now + 1 + PresenceChannel::DEFAULT_TIMEOUT+ Jobs::PresenceChannelAutoLeave.new.execute({})+expect(channel.count).to eq(0)end