Skip to content

Commit 471e95c

Browse files
committed
Use openHPI-managed tubesock fork
Tubesock is outdated and should be replaced with ActionCable. For now, however, we simply patch the issues we've discovered.
1 parent 2ff54df commit 471e95c

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ gem 'sorcery'
5252
gem 'sprockets-rails'
5353
gem 'telegraf'
5454
gem 'terser', require: false
55-
gem 'tubesock'
55+
gem 'tubesock', github: 'openhpi/tubesock'
5656
gem 'turbolinks'
5757
gem 'whenever', require: false
5858
gem 'zxcvbn-ruby', require: 'zxcvbn'

Gemfile.lock

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
GIT
2+
remote: https://github.com/openhpi/tubesock.git
3+
revision: 6952050f00e795c3d96eb0a5ee163784de41cd8b
4+
specs:
5+
tubesock (0.2.9)
6+
rack (>= 1.5.0)
7+
websocket (>= 1.1.0)
8+
19
GEM
210
remote: https://rubygems.org/
311
specs:
@@ -551,9 +559,6 @@ GEM
551559
thor (1.3.2)
552560
tilt (2.4.0)
553561
timeout (0.4.1)
554-
tubesock (0.2.9)
555-
rack (>= 1.5.0)
556-
websocket (>= 1.1.0)
557562
turbo-rails (2.0.10)
558563
actionpack (>= 6.0.0)
559564
railties (>= 6.0.0)
@@ -671,7 +676,7 @@ DEPENDENCIES
671676
stackprof
672677
telegraf
673678
terser
674-
tubesock
679+
tubesock!
675680
turbolinks
676681
web-console
677682
webmock

config/initializers/monkey_patches.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,3 @@ module InstanceMethods
2828
end
2929
end
3030
end
31-
32-
# Tubesock uses a deprecated method to clear active connections with ActiveRecord.
33-
# Hence, we update the method call to the new method name (including `connection_handler`).
34-
module Tubesock::Hijack
35-
extend ActiveSupport::Concern
36-
37-
# First, we need to remove the old `included` definition.
38-
# Otherwise, we would get an `ActiveSupport::Concern::MultipleIncludedBlocks` exception.
39-
remove_instance_variable :@_included_block
40-
41-
included do
42-
def hijack
43-
sock = Tubesock.hijack(request.env)
44-
yield sock
45-
sock.onclose do
46-
ActiveRecord::Base.connection_handler.clear_active_connections! if defined? ActiveRecord
47-
end
48-
sock.listen
49-
render plain: nil, status: -1
50-
end
51-
end
52-
end

0 commit comments

Comments
 (0)