pubsubstub 0.1.3 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/.github/workflows/ci.yml +35 -0
 - data/Gemfile +4 -5
 - data/lib/pubsubstub/channel.rb +5 -5
 - data/lib/pubsubstub/stream_action.rb +4 -12
 - data/lib/pubsubstub/subscriber.rb +1 -1
 - data/lib/pubsubstub/version.rb +1 -1
 - data/pubsubstub.gemspec +3 -3
 - data/spec/spec_helper.rb +5 -11
 - data/spec/stream_action_spec.rb +6 -10
 - data/spec/subscriber_spec.rb +7 -2
 - data/spec/support/http_helpers.rb +3 -3
 - metadata +22 -27
 - data/.travis.yml +0 -11
 - data/gemfiles/Gemfile.rack-1.x +0 -11
 - data/gemfiles/Gemfile.rack-1.x.lock +0 -57
 - data/gemfiles/Gemfile.rack-2.x +0 -11
 - data/gemfiles/Gemfile.rack-2.x.lock +0 -57
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6c8dd8515862da676e40ce08fc68bbacc2c3fc1a5d5774fe0120c45606a0f40e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b09ba3fcf02b39d4f119daecb8ea8e6099ae06d60466d88c04602a51f654be90
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 76cb8590bb052cfd85426def3697bbf17a870119c6720469a42a2bb3ae5a33e960ccfb4d983855d30525134870a3b71443b19a59279d62180b45b80562938867
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6f8ff354315f011a332f0a838c499adfcd8cb8c5ad8fa0905376abf9fa8541dc232a56400dfe591eae3f5f82a7ca4f44347b3cdfa1b9dee517d88f83bcc5d8e9
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: CI
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            on: [push, pull_request]
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 6 
     | 
    
         
            +
              test:
         
     | 
| 
      
 7 
     | 
    
         
            +
                name: Tests with Ruby ${{ matrix.ruby_version }}
         
     | 
| 
      
 8 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 9 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 10 
     | 
    
         
            +
                  fail-fast: false
         
     | 
| 
      
 11 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 12 
     | 
    
         
            +
                    ruby_version:
         
     | 
| 
      
 13 
     | 
    
         
            +
                      - '2.7'
         
     | 
| 
      
 14 
     | 
    
         
            +
                      - '3.0'
         
     | 
| 
      
 15 
     | 
    
         
            +
                      - '3.1'
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                services:
         
     | 
| 
      
 18 
     | 
    
         
            +
                  redis:
         
     | 
| 
      
 19 
     | 
    
         
            +
                    image: redis
         
     | 
| 
      
 20 
     | 
    
         
            +
                    ports:
         
     | 
| 
      
 21 
     | 
    
         
            +
                      - 6379:6379
         
     | 
| 
      
 22 
     | 
    
         
            +
                    options: --entrypoint redis-server
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 25 
     | 
    
         
            +
                - uses: actions/checkout@v1
         
     | 
| 
      
 26 
     | 
    
         
            +
                - name: Set up Ruby ${{ matrix.ruby_version }}
         
     | 
| 
      
 27 
     | 
    
         
            +
                  uses: ruby/setup-ruby@v1
         
     | 
| 
      
 28 
     | 
    
         
            +
                  with:
         
     | 
| 
      
 29 
     | 
    
         
            +
                    ruby-version: ${{ matrix.ruby_version }}
         
     | 
| 
      
 30 
     | 
    
         
            +
                    bundler-cache: true
         
     | 
| 
      
 31 
     | 
    
         
            +
                - name: Run tests
         
     | 
| 
      
 32 
     | 
    
         
            +
                  env:
         
     | 
| 
      
 33 
     | 
    
         
            +
                    RAILS_ENV: test
         
     | 
| 
      
 34 
     | 
    
         
            +
                  run: |
         
     | 
| 
      
 35 
     | 
    
         
            +
                    bundle exec rake
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -3,10 +3,9 @@ source 'https://rubygems.org' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            # Specify your gem's dependencies in pubsubstub.gemspec
         
     | 
| 
       4 
4 
     | 
    
         
             
            gemspec
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            gem "rspec" 
     | 
| 
       7 
     | 
    
         
            -
            gem " 
     | 
| 
       8 
     | 
    
         
            -
            gem " 
     | 
| 
       9 
     | 
    
         
            -
            gem "thin", "~> 1.6"
         
     | 
| 
      
 6 
     | 
    
         
            +
            gem "rspec"
         
     | 
| 
      
 7 
     | 
    
         
            +
            gem "puma"
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem "thin"
         
     | 
| 
       10 
9 
     | 
    
         
             
            gem "rack-test"
         
     | 
| 
       11 
10 
     | 
    
         
             
            gem "timecop"
         
     | 
| 
       12 
     | 
    
         
            -
            gem "rake" 
     | 
| 
      
 11 
     | 
    
         
            +
            gem "rake"
         
     | 
    
        data/lib/pubsubstub/channel.rb
    CHANGED
    
    | 
         @@ -13,11 +13,11 @@ module Pubsubstub 
     | 
|
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                def publish(event)
         
     | 
| 
       16 
     | 
    
         
            -
                  redis.pipelined do
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
                     
     | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
       20 
     | 
    
         
            -
                     
     | 
| 
      
 16 
     | 
    
         
            +
                  redis.pipelined do |pipeline|
         
     | 
| 
      
 17 
     | 
    
         
            +
                    pipeline.zadd(scrollback_key, event.id, event.to_json)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    pipeline.zremrangebyrank(scrollback_key, 0, -Pubsubstub.channels_scrollback_size)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    pipeline.expire(scrollback_key, Pubsubstub.channels_scrollback_ttl)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    pipeline.publish(pubsub_key, event.to_json)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  end
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
         @@ -24,7 +24,7 @@ module Pubsubstub 
     | 
|
| 
       24 
24 
     | 
    
         
             
                  else
         
     | 
| 
       25 
25 
     | 
    
         
             
                    send_scrollback(channels, last_event_id)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  end
         
     | 
| 
       27 
     | 
    
         
            -
                  [200, HEADERS, stream]
         
     | 
| 
      
 27 
     | 
    
         
            +
                  [200, HEADERS.dup, stream]
         
     | 
| 
       28 
28 
     | 
    
         
             
                end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                private
         
     | 
| 
         @@ -41,11 +41,7 @@ module Pubsubstub 
     | 
|
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                def use_persistent_connections?
         
     | 
| 
       44 
     | 
    
         
            -
                  Pubsubstub.use_persistent_connections 
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                def event_machine?
         
     | 
| 
       48 
     | 
    
         
            -
                  defined?(EventMachine) && EventMachine.reactor_running?
         
     | 
| 
      
 44 
     | 
    
         
            +
                  Pubsubstub.use_persistent_connections
         
     | 
| 
       49 
45 
     | 
    
         
             
                end
         
     | 
| 
       50 
46 
     | 
    
         | 
| 
       51 
47 
     | 
    
         
             
                def subscribe_connection(channels, last_event_id)
         
     | 
| 
         @@ -74,12 +70,8 @@ module Pubsubstub 
     | 
|
| 
       74 
70 
     | 
    
         
             
                  @mutex.synchronize do
         
     | 
| 
       75 
71 
     | 
    
         
             
                    return if defined? @helper_threads_initialized
         
     | 
| 
       76 
72 
     | 
    
         
             
                    @helper_threads_initialized = true
         
     | 
| 
       77 
     | 
    
         
            -
                     
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                    else
         
     | 
| 
       80 
     | 
    
         
            -
                      start_subscriber
         
     | 
| 
       81 
     | 
    
         
            -
                      start_heartbeat
         
     | 
| 
       82 
     | 
    
         
            -
                    end
         
     | 
| 
      
 73 
     | 
    
         
            +
                    start_subscriber
         
     | 
| 
      
 74 
     | 
    
         
            +
                    start_heartbeat
         
     | 
| 
       83 
75 
     | 
    
         
             
                  end
         
     | 
| 
       84 
76 
     | 
    
         
             
                end
         
     | 
| 
       85 
77 
     | 
    
         | 
| 
         @@ -31,7 +31,7 @@ module Pubsubstub 
     | 
|
| 
       31 
31 
     | 
    
         
             
                  # redis.client.call allow to bypass the client mutex
         
     | 
| 
       32 
32 
     | 
    
         
             
                  # Since we now that the only other possible caller is blocking on reading the socket this is safe
         
     | 
| 
       33 
33 
     | 
    
         
             
                  synchronize do
         
     | 
| 
       34 
     | 
    
         
            -
                    redis. 
     | 
| 
      
 34 
     | 
    
         
            +
                    redis._client.call(['punsubscribe', pubsub_pattern])
         
     | 
| 
       35 
35 
     | 
    
         
             
                  end
         
     | 
| 
       36 
36 
     | 
    
         
             
                end
         
     | 
| 
       37 
37 
     | 
    
         | 
    
        data/lib/pubsubstub/version.rb
    CHANGED
    
    
    
        data/pubsubstub.gemspec
    CHANGED
    
    | 
         @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       10 
10 
     | 
    
         
             
              spec.email         = ["gmalette@gmail.com"]
         
     | 
| 
       11 
11 
     | 
    
         
             
              spec.summary       = %q{Pubsubstub is a rack middleware to add Pub/Sub}
         
     | 
| 
       12 
12 
     | 
    
         
             
              spec.description   = %q{Pubsubstub can be added to a rack Application or deployed standalone. It uses Redis to do the Pub/Sub}
         
     | 
| 
       13 
     | 
    
         
            -
              spec.homepage      = "https://github.com/ 
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = "https://github.com/byroot/pubsubstub"
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.license       = "MIT"
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              spec.files         = `git ls-files`.split($/)
         
     | 
| 
         @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       19 
19 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              spec.add_dependency 'rack'
         
     | 
| 
       22 
     | 
    
         
            -
              spec.add_dependency 'redis', "~>  
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_dependency 'redis', "~> 4.0"
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              spec.add_development_dependency "bundler" 
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency "bundler"
         
     | 
| 
       25 
25 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -1,7 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'open3'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'rack/test'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'pry'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'pry-byebug'
         
     | 
| 
       5 
3 
     | 
    
         
             
            require 'timecop'
         
     | 
| 
       6 
4 
     | 
    
         
             
            require 'thread'
         
     | 
| 
       7 
5 
     | 
    
         | 
| 
         @@ -16,15 +14,6 @@ require_relative '../lib/pubsubstub' 
     | 
|
| 
       16 
14 
     | 
    
         
             
            Pubsubstub.logger = Logger.new(nil)
         
     | 
| 
       17 
15 
     | 
    
         
             
            Pubsubstub.logger.level = Logger::DEBUG
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
            # Fake EM
         
     | 
| 
       20 
     | 
    
         
            -
            module EventMachine
         
     | 
| 
       21 
     | 
    
         
            -
              extend self
         
     | 
| 
       22 
     | 
    
         
            -
              
         
     | 
| 
       23 
     | 
    
         
            -
              def reactor_running?
         
     | 
| 
       24 
     | 
    
         
            -
                false
         
     | 
| 
       25 
     | 
    
         
            -
              end
         
     | 
| 
       26 
     | 
    
         
            -
            end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
17 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
       29 
18 
     | 
    
         
             
              config.include Rack::Test::Methods
         
     | 
| 
       30 
19 
     | 
    
         
             
              config.include HTTPHelpers
         
     | 
| 
         @@ -36,4 +25,9 @@ RSpec.configure do |config| 
     | 
|
| 
       36 
25 
     | 
    
         
             
              config.order = 'random'
         
     | 
| 
       37 
26 
     | 
    
         | 
| 
       38 
27 
     | 
    
         
             
              config.before(:each) { Redis.new(url: Pubsubstub.redis_url).flushdb }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              # Clean threads after finish
         
     | 
| 
      
 30 
     | 
    
         
            +
              config.after(:each) do
         
     | 
| 
      
 31 
     | 
    
         
            +
                Thread.list.each { |thread| thread.join(0.5) if thread != Thread.current }
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
       39 
33 
     | 
    
         
             
            end
         
     | 
    
        data/spec/stream_action_spec.rb
    CHANGED
    
    | 
         @@ -21,14 +21,6 @@ end 
     | 
|
| 
       21 
21 
     | 
    
         
             
            describe Pubsubstub::StreamAction do
         
     | 
| 
       22 
22 
     | 
    
         
             
              let(:app) { Pubsubstub::StreamAction.new }
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              context "with EventMachine" do
         
     | 
| 
       25 
     | 
    
         
            -
                before do
         
     | 
| 
       26 
     | 
    
         
            -
                  allow(EventMachine).to receive(:reactor_running?).and_return(true)
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                it_behaves_like "short lived connections"
         
     | 
| 
       30 
     | 
    
         
            -
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
24 
     | 
    
         
             
              context "with persistent connections disabled" do
         
     | 
| 
       33 
25 
     | 
    
         
             
                around :example do |example|
         
     | 
| 
       34 
26 
     | 
    
         
             
                  previous = Pubsubstub.use_persistent_connections
         
     | 
| 
         @@ -44,7 +36,7 @@ describe Pubsubstub::StreamAction do 
     | 
|
| 
       44 
36 
     | 
    
         
             
                with_background_server do
         
     | 
| 
       45 
37 
     | 
    
         
             
                  expect(9292).to listen.in_under(5)
         
     | 
| 
       46 
38 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                  chunks = async_get('http://localhost:9292/?channels[]=foo', 'Last-Event-Id' => '0')
         
     | 
| 
      
 39 
     | 
    
         
            +
                  chunks, thread = async_get('http://localhost:9292/?channels[]=foo', { 'Last-Event-Id' => '0' })
         
     | 
| 
       48 
40 
     | 
    
         
             
                  expect(chunks.pop).to include("event: heartbeat\n")
         
     | 
| 
       49 
41 
     | 
    
         | 
| 
       50 
42 
     | 
    
         
             
                  Pubsubstub.publish('foo', 'bar', id: 1)
         
     | 
| 
         @@ -52,6 +44,8 @@ describe Pubsubstub::StreamAction do 
     | 
|
| 
       52 
44 
     | 
    
         | 
| 
       53 
45 
     | 
    
         
             
                  Pubsubstub.publish('foo', 'baz', id: 2)
         
     | 
| 
       54 
46 
     | 
    
         
             
                  expect(chunks.pop).to include("id: 2\n")
         
     | 
| 
      
 47 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 48 
     | 
    
         
            +
                  thread.kill
         
     | 
| 
       55 
49 
     | 
    
         
             
                end
         
     | 
| 
       56 
50 
     | 
    
         
             
              end
         
     | 
| 
       57 
51 
     | 
    
         | 
| 
         @@ -61,11 +55,13 @@ describe Pubsubstub::StreamAction do 
     | 
|
| 
       61 
55 
     | 
    
         
             
                with_background_server do
         
     | 
| 
       62 
56 
     | 
    
         
             
                  expect(9292).to listen.in_under(5)
         
     | 
| 
       63 
57 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                  chunks = async_get('http://localhost:9292/?channels[]=foo', 'Last-Event-Id' => '0')
         
     | 
| 
      
 58 
     | 
    
         
            +
                  chunks, thread = async_get('http://localhost:9292/?channels[]=foo', { 'Last-Event-Id' => '0' })
         
     | 
| 
       65 
59 
     | 
    
         
             
                  expect(chunks.pop).to include("id: 1\n")
         
     | 
| 
       66 
60 
     | 
    
         | 
| 
       67 
61 
     | 
    
         
             
                  Pubsubstub.publish('foo', 'baz', id: 2)
         
     | 
| 
       68 
62 
     | 
    
         
             
                  expect(chunks.pop).to include("id: 2\n")
         
     | 
| 
      
 63 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 64 
     | 
    
         
            +
                  thread.kill
         
     | 
| 
       69 
65 
     | 
    
         
             
                end
         
     | 
| 
       70 
66 
     | 
    
         
             
              end
         
     | 
| 
       71 
67 
     | 
    
         
             
            end
         
     | 
    
        data/spec/subscriber_spec.rb
    CHANGED
    
    | 
         @@ -10,12 +10,17 @@ RSpec.describe Pubsubstub::Subscriber do 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  subject.add_event_listener('plop', -> (event) { published_events << event })
         
     | 
| 
       11 
11 
     | 
    
         
             
                  subscribe_thread = Thread.new { subject.start }
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                  expect { subject.subscribed? }.to happen
         
     | 
| 
      
 13 
     | 
    
         
            +
                  expect { subject.subscribed? }.to happen.in_under(1)
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                  events.each(&channel.method(:publish))
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
                  expect { published_events.size == events.size }.to happen.in_under(2)
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       17 
19 
     | 
    
         
             
                  subject.stop
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  subscribe_thread.join(2)
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  expect { ! subject.subscribed? }.to happen.in_under(1)
         
     | 
| 
       19 
24 
     | 
    
         | 
| 
       20 
25 
     | 
    
         
             
                  expect(subscribe_thread).to complete
         
     | 
| 
       21 
26 
     | 
    
         | 
| 
         @@ -4,9 +4,9 @@ module HTTPHelpers 
     | 
|
| 
       4 
4 
     | 
    
         
             
              def async_get(uri, headers = {}, retries: 10, &block)
         
     | 
| 
       5 
5 
     | 
    
         
             
                uri = URI(uri.to_s)
         
     | 
| 
       6 
6 
     | 
    
         
             
                queue = Queue.new
         
     | 
| 
       7 
     | 
    
         
            -
                Thread.start do
         
     | 
| 
      
 7 
     | 
    
         
            +
                thread = Thread.start do
         
     | 
| 
       8 
8 
     | 
    
         
             
                  begin
         
     | 
| 
       9 
     | 
    
         
            -
                    Net::HTTP.start(uri.host, uri.port) do |http|
         
     | 
| 
      
 9 
     | 
    
         
            +
                    Net::HTTP.start(uri.host, uri.port, open_timeout: 10) do |http|
         
     | 
| 
       10 
10 
     | 
    
         
             
                      request = Net::HTTP::Get.new uri.request_uri
         
     | 
| 
       11 
11 
     | 
    
         
             
                      headers.each do |name, value|
         
     | 
| 
       12 
12 
     | 
    
         
             
                        request.add_field(name, value)
         
     | 
| 
         @@ -33,7 +33,7 @@ module HTTPHelpers 
     | 
|
| 
       33 
33 
     | 
    
         
             
                  end
         
     | 
| 
       34 
34 
     | 
    
         
             
                end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                queue
         
     | 
| 
      
 36 
     | 
    
         
            +
                return queue, thread
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
              ROOT_PATH = File.join(__dir__, '../..')
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,57 +1,57 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: pubsubstub
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Guillaume Malette
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-03-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rack
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - -  
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
19 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - -  
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: redis
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '4.0'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '4.0'
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: bundler
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - -  
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       46 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       48 
48 
     | 
    
         
             
              type: :development
         
     | 
| 
       49 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - -  
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       55 
55 
     | 
    
         
             
            description: Pubsubstub can be added to a rack Application or deployed standalone.
         
     | 
| 
       56 
56 
     | 
    
         
             
              It uses Redis to do the Pub/Sub
         
     | 
| 
       57 
57 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -62,9 +62,9 @@ executables: 
     | 
|
| 
       62 
62 
     | 
    
         
             
            extensions: []
         
     | 
| 
       63 
63 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       64 
64 
     | 
    
         
             
            files:
         
     | 
| 
       65 
     | 
    
         
            -
            - . 
     | 
| 
       66 
     | 
    
         
            -
            - . 
     | 
| 
       67 
     | 
    
         
            -
            - . 
     | 
| 
      
 65 
     | 
    
         
            +
            - ".github/workflows/ci.yml"
         
     | 
| 
      
 66 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 67 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
       68 
68 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       69 
69 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       70 
70 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -74,10 +74,6 @@ files: 
     | 
|
| 
       74 
74 
     | 
    
         
             
            - example/Gemfile
         
     | 
| 
       75 
75 
     | 
    
         
             
            - example/config.ru
         
     | 
| 
       76 
76 
     | 
    
         
             
            - example/puma_config.rb
         
     | 
| 
       77 
     | 
    
         
            -
            - gemfiles/Gemfile.rack-1.x
         
     | 
| 
       78 
     | 
    
         
            -
            - gemfiles/Gemfile.rack-1.x.lock
         
     | 
| 
       79 
     | 
    
         
            -
            - gemfiles/Gemfile.rack-2.x
         
     | 
| 
       80 
     | 
    
         
            -
            - gemfiles/Gemfile.rack-2.x.lock
         
     | 
| 
       81 
77 
     | 
    
         
             
            - lib/pubsubstub.rb
         
     | 
| 
       82 
78 
     | 
    
         
             
            - lib/pubsubstub/application.rb
         
     | 
| 
       83 
79 
     | 
    
         
             
            - lib/pubsubstub/channel.rb
         
     | 
| 
         @@ -99,28 +95,27 @@ files: 
     | 
|
| 
       99 
95 
     | 
    
         
             
            - spec/subscription_spec.rb
         
     | 
| 
       100 
96 
     | 
    
         
             
            - spec/support/http_helpers.rb
         
     | 
| 
       101 
97 
     | 
    
         
             
            - spec/support/threading_matchers.rb
         
     | 
| 
       102 
     | 
    
         
            -
            homepage: https://github.com/ 
     | 
| 
      
 98 
     | 
    
         
            +
            homepage: https://github.com/byroot/pubsubstub
         
     | 
| 
       103 
99 
     | 
    
         
             
            licenses:
         
     | 
| 
       104 
100 
     | 
    
         
             
            - MIT
         
     | 
| 
       105 
101 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       106 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 102 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       107 
103 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       108 
104 
     | 
    
         
             
            require_paths:
         
     | 
| 
       109 
105 
     | 
    
         
             
            - lib
         
     | 
| 
       110 
106 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       111 
107 
     | 
    
         
             
              requirements:
         
     | 
| 
       112 
     | 
    
         
            -
              - -  
     | 
| 
      
 108 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       113 
109 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       114 
110 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       115 
111 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       116 
112 
     | 
    
         
             
              requirements:
         
     | 
| 
       117 
     | 
    
         
            -
              - -  
     | 
| 
      
 113 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       118 
114 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       119 
115 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       120 
116 
     | 
    
         
             
            requirements: []
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
      
 117 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
      
 118 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       124 
119 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       125 
120 
     | 
    
         
             
            summary: Pubsubstub is a rack middleware to add Pub/Sub
         
     | 
| 
       126 
121 
     | 
    
         
             
            test_files:
         
     | 
    
        data/.travis.yml
    DELETED
    
    
    
        data/gemfiles/Gemfile.rack-1.x
    DELETED
    
    
| 
         @@ -1,57 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            GEM
         
     | 
| 
       2 
     | 
    
         
            -
              remote: https://rubygems.org/
         
     | 
| 
       3 
     | 
    
         
            -
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                byebug (9.0.5)
         
     | 
| 
       5 
     | 
    
         
            -
                coderay (1.1.1)
         
     | 
| 
       6 
     | 
    
         
            -
                daemons (1.2.4)
         
     | 
| 
       7 
     | 
    
         
            -
                diff-lcs (1.2.5)
         
     | 
| 
       8 
     | 
    
         
            -
                eventmachine (1.2.0.1)
         
     | 
| 
       9 
     | 
    
         
            -
                method_source (0.8.2)
         
     | 
| 
       10 
     | 
    
         
            -
                pry (0.10.4)
         
     | 
| 
       11 
     | 
    
         
            -
                  coderay (~> 1.1.0)
         
     | 
| 
       12 
     | 
    
         
            -
                  method_source (~> 0.8.1)
         
     | 
| 
       13 
     | 
    
         
            -
                  slop (~> 3.4)
         
     | 
| 
       14 
     | 
    
         
            -
                pry-byebug (3.4.0)
         
     | 
| 
       15 
     | 
    
         
            -
                  byebug (~> 9.0)
         
     | 
| 
       16 
     | 
    
         
            -
                  pry (~> 0.10)
         
     | 
| 
       17 
     | 
    
         
            -
                puma (3.6.0)
         
     | 
| 
       18 
     | 
    
         
            -
                rack (1.6.4)
         
     | 
| 
       19 
     | 
    
         
            -
                rack-test (0.6.3)
         
     | 
| 
       20 
     | 
    
         
            -
                  rack (>= 1.0)
         
     | 
| 
       21 
     | 
    
         
            -
                rake (10.5.0)
         
     | 
| 
       22 
     | 
    
         
            -
                redis (3.3.1)
         
     | 
| 
       23 
     | 
    
         
            -
                rspec (3.1.0)
         
     | 
| 
       24 
     | 
    
         
            -
                  rspec-core (~> 3.1.0)
         
     | 
| 
       25 
     | 
    
         
            -
                  rspec-expectations (~> 3.1.0)
         
     | 
| 
       26 
     | 
    
         
            -
                  rspec-mocks (~> 3.1.0)
         
     | 
| 
       27 
     | 
    
         
            -
                rspec-core (3.1.7)
         
     | 
| 
       28 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       29 
     | 
    
         
            -
                rspec-expectations (3.1.2)
         
     | 
| 
       30 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       31 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       32 
     | 
    
         
            -
                rspec-mocks (3.1.3)
         
     | 
| 
       33 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       34 
     | 
    
         
            -
                rspec-support (3.1.2)
         
     | 
| 
       35 
     | 
    
         
            -
                slop (3.6.0)
         
     | 
| 
       36 
     | 
    
         
            -
                thin (1.7.0)
         
     | 
| 
       37 
     | 
    
         
            -
                  daemons (~> 1.0, >= 1.0.9)
         
     | 
| 
       38 
     | 
    
         
            -
                  eventmachine (~> 1.0, >= 1.0.4)
         
     | 
| 
       39 
     | 
    
         
            -
                  rack (>= 1, < 3)
         
     | 
| 
       40 
     | 
    
         
            -
                timecop (0.8.1)
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            PLATFORMS
         
     | 
| 
       43 
     | 
    
         
            -
              ruby
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            DEPENDENCIES
         
     | 
| 
       46 
     | 
    
         
            -
              pry-byebug
         
     | 
| 
       47 
     | 
    
         
            -
              puma (~> 3.4)
         
     | 
| 
       48 
     | 
    
         
            -
              rack (< 2)
         
     | 
| 
       49 
     | 
    
         
            -
              rack-test
         
     | 
| 
       50 
     | 
    
         
            -
              rake (~> 10.0)
         
     | 
| 
       51 
     | 
    
         
            -
              redis (~> 3.0)
         
     | 
| 
       52 
     | 
    
         
            -
              rspec (= 3.1.0)
         
     | 
| 
       53 
     | 
    
         
            -
              thin (~> 1.6)
         
     | 
| 
       54 
     | 
    
         
            -
              timecop
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
            BUNDLED WITH
         
     | 
| 
       57 
     | 
    
         
            -
               1.12.5
         
     | 
    
        data/gemfiles/Gemfile.rack-2.x
    DELETED
    
    
| 
         @@ -1,57 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            GEM
         
     | 
| 
       2 
     | 
    
         
            -
              remote: https://rubygems.org/
         
     | 
| 
       3 
     | 
    
         
            -
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                byebug (9.0.5)
         
     | 
| 
       5 
     | 
    
         
            -
                coderay (1.1.1)
         
     | 
| 
       6 
     | 
    
         
            -
                daemons (1.2.4)
         
     | 
| 
       7 
     | 
    
         
            -
                diff-lcs (1.2.5)
         
     | 
| 
       8 
     | 
    
         
            -
                eventmachine (1.2.0.1)
         
     | 
| 
       9 
     | 
    
         
            -
                method_source (0.8.2)
         
     | 
| 
       10 
     | 
    
         
            -
                pry (0.10.4)
         
     | 
| 
       11 
     | 
    
         
            -
                  coderay (~> 1.1.0)
         
     | 
| 
       12 
     | 
    
         
            -
                  method_source (~> 0.8.1)
         
     | 
| 
       13 
     | 
    
         
            -
                  slop (~> 3.4)
         
     | 
| 
       14 
     | 
    
         
            -
                pry-byebug (3.4.0)
         
     | 
| 
       15 
     | 
    
         
            -
                  byebug (~> 9.0)
         
     | 
| 
       16 
     | 
    
         
            -
                  pry (~> 0.10)
         
     | 
| 
       17 
     | 
    
         
            -
                puma (3.6.0)
         
     | 
| 
       18 
     | 
    
         
            -
                rack (2.0.1)
         
     | 
| 
       19 
     | 
    
         
            -
                rack-test (0.6.3)
         
     | 
| 
       20 
     | 
    
         
            -
                  rack (>= 1.0)
         
     | 
| 
       21 
     | 
    
         
            -
                rake (10.5.0)
         
     | 
| 
       22 
     | 
    
         
            -
                redis (3.3.1)
         
     | 
| 
       23 
     | 
    
         
            -
                rspec (3.1.0)
         
     | 
| 
       24 
     | 
    
         
            -
                  rspec-core (~> 3.1.0)
         
     | 
| 
       25 
     | 
    
         
            -
                  rspec-expectations (~> 3.1.0)
         
     | 
| 
       26 
     | 
    
         
            -
                  rspec-mocks (~> 3.1.0)
         
     | 
| 
       27 
     | 
    
         
            -
                rspec-core (3.1.7)
         
     | 
| 
       28 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       29 
     | 
    
         
            -
                rspec-expectations (3.1.2)
         
     | 
| 
       30 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       31 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       32 
     | 
    
         
            -
                rspec-mocks (3.1.3)
         
     | 
| 
       33 
     | 
    
         
            -
                  rspec-support (~> 3.1.0)
         
     | 
| 
       34 
     | 
    
         
            -
                rspec-support (3.1.2)
         
     | 
| 
       35 
     | 
    
         
            -
                slop (3.6.0)
         
     | 
| 
       36 
     | 
    
         
            -
                thin (1.7.0)
         
     | 
| 
       37 
     | 
    
         
            -
                  daemons (~> 1.0, >= 1.0.9)
         
     | 
| 
       38 
     | 
    
         
            -
                  eventmachine (~> 1.0, >= 1.0.4)
         
     | 
| 
       39 
     | 
    
         
            -
                  rack (>= 1, < 3)
         
     | 
| 
       40 
     | 
    
         
            -
                timecop (0.8.1)
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            PLATFORMS
         
     | 
| 
       43 
     | 
    
         
            -
              ruby
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            DEPENDENCIES
         
     | 
| 
       46 
     | 
    
         
            -
              pry-byebug
         
     | 
| 
       47 
     | 
    
         
            -
              puma (~> 3.4)
         
     | 
| 
       48 
     | 
    
         
            -
              rack (~> 2.0)
         
     | 
| 
       49 
     | 
    
         
            -
              rack-test
         
     | 
| 
       50 
     | 
    
         
            -
              rake (~> 10.0)
         
     | 
| 
       51 
     | 
    
         
            -
              redis (~> 3.0)
         
     | 
| 
       52 
     | 
    
         
            -
              rspec (= 3.1.0)
         
     | 
| 
       53 
     | 
    
         
            -
              thin (~> 1.6)
         
     | 
| 
       54 
     | 
    
         
            -
              timecop
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
            BUNDLED WITH
         
     | 
| 
       57 
     | 
    
         
            -
               1.12.5
         
     |