aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-03-04 05:31:48 +1030
committerMatthew Draper <matthew@trebex.net>2016-03-04 05:31:48 +1030
commitbbba0649f529626a076c4247047b60cfbe86d5e4 (patch)
treecdbf52c160399441574d1f13dd6587ee504e002d /actioncable/lib/action_cable/subscription_adapter/postgresql.rb
parentcd73632d9d47752013f46e775e59241215cfd8e9 (diff)
parenta373be9da45d4bee684ea03420212780ec1ef4b1 (diff)
downloadrails-bbba0649f529626a076c4247047b60cfbe86d5e4.tar.gz
rails-bbba0649f529626a076c4247047b60cfbe86d5e4.tar.bz2
rails-bbba0649f529626a076c4247047b60cfbe86d5e4.zip
Merge pull request #23992 from matthewd/em-option
Support faye-websocket + EventMachine as an option
Diffstat (limited to 'actioncable/lib/action_cable/subscription_adapter/postgresql.rb')
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/postgresql.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
index abaeb92e54..66c7852f6e 100644
--- a/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
@@ -42,14 +42,15 @@ module ActionCable
private
def listener
- @listener || @server.mutex.synchronize { @listener ||= Listener.new(self) }
+ @listener || @server.mutex.synchronize { @listener ||= Listener.new(self, @server.event_loop) }
end
class Listener < SubscriberMap
- def initialize(adapter)
+ def initialize(adapter, event_loop)
super()
@adapter = adapter
+ @event_loop = event_loop
@queue = Queue.new
@thread = Thread.new do
@@ -68,7 +69,7 @@ module ActionCable
case action
when :listen
pg_conn.exec("LISTEN #{pg_conn.escape_identifier channel}")
- Concurrent.global_io_executor << callback if callback
+ @event_loop.post(&callback) if callback
when :unlisten
pg_conn.exec("UNLISTEN #{pg_conn.escape_identifier channel}")
when :shutdown
@@ -98,7 +99,7 @@ module ActionCable
end
def invoke_callback(*)
- Concurrent.global_io_executor.post { super }
+ @event_loop.post { super }
end
end
end