semian 0.13.0 → 0.13.3
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 +4 -4
 - data/CHANGELOG.md +12 -0
 - data/lib/semian/mysql2.rb +10 -8
 - data/lib/semian/rails.rb +28 -7
 - data/lib/semian/redis.rb +14 -7
 - data/lib/semian/version.rb +1 -1
 - metadata +13 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b572c4e4fa4dee4453017187bc759a29890dca1627f8bebea6207223e58e49ba
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f8b7f8eda600b096242becc44cb80a10592d9a9b2490349eecb5c11a008c0fe0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 30c39a27e0e57ddcccc794fbe9cc04f1d84c864c1cd2786bb2e4e6e7050b51f152feeba8c66c59d1feae3c195b93a921a76aa1985dc034f00e3394d6b4cb3123
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 922ba4aa39b90898b84cb301ee28344e5cfe8f57b523e531db24bba2bee3731d55dda0256bf7dd923fe33175daad960a93a1090addad68a448e6fe384a6a8c42
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Unreleased
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            # v0.13.3
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Add a warning message about redis 5.x. (#386)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # v0.13.2
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * Fix: Update AbstractAdapter patch to accomodate recent Rails changes. (#364)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            # v0.13.1
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            * Fix: Raise `Redis::OutOfMemoryError` for messages that match `OOM command not allowed when used memory > 'maxmemory'` rather than checking `start_with?("OOM ")`. (#367)
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       3 
15 
     | 
    
         
             
            # v0.13.0
         
     | 
| 
       4 
16 
     | 
    
         | 
| 
       5 
17 
     | 
    
         
             
            * Refactor: Replace Time.now with CLOCK_MONOTONIC in MockServer (#318)
         
     | 
    
        data/lib/semian/mysql2.rb
    CHANGED
    
    | 
         @@ -43,16 +43,18 @@ module Semian 
     | 
|
| 
       43 
43 
     | 
    
         
             
                  %r{\A(?:/\*.*?\*/)?\s*RELEASE\s+SAVEPOINT}i,
         
     | 
| 
       44 
44 
     | 
    
         
             
                )
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                 
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                  base 
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 47 
     | 
    
         
            +
                  # The naked methods are exposed as `raw_query` and `raw_connect` for instrumentation purpose
         
     | 
| 
      
 48 
     | 
    
         
            +
                  def included(base)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    base.send(:alias_method, :raw_query, :query)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    base.send(:remove_method, :query)
         
     | 
| 
       50 
51 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
                    base.send(:alias_method, :raw_connect, :connect)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    base.send(:remove_method, :connect)
         
     | 
| 
       53 
54 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
      
 55 
     | 
    
         
            +
                    base.send(:alias_method, :raw_ping, :ping)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    base.send(:remove_method, :ping)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
       56 
58 
     | 
    
         
             
                end
         
     | 
| 
       57 
59 
     | 
    
         | 
| 
       58 
60 
     | 
    
         
             
                def semian_identifier
         
     | 
    
        data/lib/semian/rails.rb
    CHANGED
    
    | 
         @@ -2,14 +2,35 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require "active_record/connection_adapters/abstract_adapter"
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            module  
     | 
| 
       6 
     | 
    
         
            -
              module  
     | 
| 
       7 
     | 
    
         
            -
                 
     | 
| 
       8 
     | 
    
         
            -
                   
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Semian
         
     | 
| 
      
 6 
     | 
    
         
            +
              module Rails
         
     | 
| 
      
 7 
     | 
    
         
            +
                def semian_resource
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @semian_resource ||= client_connection.semian_resource
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def reconnect
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @semian_resource = nil
         
     | 
| 
      
 13 
     | 
    
         
            +
                  super
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                private
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                # client_connection is an instance of a Mysql2::Client
         
     | 
| 
      
 19 
     | 
    
         
            +
                #
         
     | 
| 
      
 20 
     | 
    
         
            +
                # The conditionals here support multiple Rails versions.
         
     | 
| 
      
 21 
     | 
    
         
            +
                #   - valid_raw_connection is for 7.1.x and above
         
     | 
| 
      
 22 
     | 
    
         
            +
                #   - @raw_connection is for 7.0.x
         
     | 
| 
      
 23 
     | 
    
         
            +
                #   - @connection is for versions below 6.1.x and below
         
     | 
| 
      
 24 
     | 
    
         
            +
                def client_connection
         
     | 
| 
      
 25 
     | 
    
         
            +
                  if respond_to?(:valid_raw_connection)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    valid_raw_connection
         
     | 
| 
      
 27 
     | 
    
         
            +
                  elsif instance_variable_defined?(:@raw_connection)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @raw_connection
         
     | 
| 
      
 29 
     | 
    
         
            +
                  else
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @connection
         
     | 
| 
       12 
31 
     | 
    
         
             
                  end
         
     | 
| 
       13 
32 
     | 
    
         
             
                end
         
     | 
| 
       14 
33 
     | 
    
         
             
              end
         
     | 
| 
       15 
34 
     | 
    
         
             
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(Semian::Rails)
         
     | 
    
        data/lib/semian/redis.rb
    CHANGED
    
    | 
         @@ -3,6 +3,11 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require "semian/adapter"
         
     | 
| 
       4 
4 
     | 
    
         
             
            require "redis"
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            if Redis::VERSION >= "5.0.0"
         
     | 
| 
      
 7 
     | 
    
         
            +
              Semian.logger.warn("NOTE: Semian is not compatible with Redis 5.x")
         
     | 
| 
      
 8 
     | 
    
         
            +
              return
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       6 
11 
     | 
    
         
             
            class Redis
         
     | 
| 
       7 
12 
     | 
    
         
             
              Redis::BaseConnectionError.include(::Semian::AdapterError)
         
     | 
| 
       8 
13 
     | 
    
         
             
              ::Errno::EINVAL.include(::Semian::AdapterError)
         
     | 
| 
         @@ -65,13 +70,15 @@ module Semian 
     | 
|
| 
       65 
70 
     | 
    
         
             
                CircuitOpenError = ::Redis::CircuitOpenError
         
     | 
| 
       66 
71 
     | 
    
         
             
                ResolveError = ::Redis::ResolveError
         
     | 
| 
       67 
72 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                  base 
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 74 
     | 
    
         
            +
                  # The naked methods are exposed as `raw_query` and `raw_connect` for instrumentation purpose
         
     | 
| 
      
 75 
     | 
    
         
            +
                  def included(base)
         
     | 
| 
      
 76 
     | 
    
         
            +
                    base.send(:alias_method, :raw_io, :io)
         
     | 
| 
      
 77 
     | 
    
         
            +
                    base.send(:remove_method, :io)
         
     | 
| 
       72 
78 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 79 
     | 
    
         
            +
                    base.send(:alias_method, :raw_connect, :connect)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    base.send(:remove_method, :connect)
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
       75 
82 
     | 
    
         
             
                end
         
     | 
| 
       76 
83 
     | 
    
         | 
| 
       77 
84 
     | 
    
         
             
                def semian_identifier
         
     | 
| 
         @@ -139,7 +146,7 @@ module Semian 
     | 
|
| 
       139 
146 
     | 
    
         | 
| 
       140 
147 
     | 
    
         
             
                def raise_if_out_of_memory(reply)
         
     | 
| 
       141 
148 
     | 
    
         
             
                  return unless reply.is_a?(::Redis::CommandError)
         
     | 
| 
       142 
     | 
    
         
            -
                  return unless reply.message 
     | 
| 
      
 149 
     | 
    
         
            +
                  return unless reply.message =~ /OOM command not allowed when used memory > 'maxmemory'/
         
     | 
| 
       143 
150 
     | 
    
         | 
| 
       144 
151 
     | 
    
         
             
                  raise ::Redis::OutOfMemoryError, reply.message
         
     | 
| 
       145 
152 
     | 
    
         
             
                end
         
     | 
    
        data/lib/semian/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: semian
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.13. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.13.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Scott Francis
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2022-09-02 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         
             
            description: |2
         
     | 
| 
       16 
16 
     | 
    
         
             
                  A Ruby C extention that is used to control access to shared resources
         
     | 
| 
         @@ -61,7 +61,17 @@ metadata: 
     | 
|
| 
       61 
61 
     | 
    
         
             
              bug_tracker_uri: https://github.com/Shopify/semian/issues
         
     | 
| 
       62 
62 
     | 
    
         
             
              changelog_uri: https://github.com/Shopify/semian/blob/master/CHANGELOG.md
         
     | 
| 
       63 
63 
     | 
    
         
             
              source_code_uri: https://github.com/Shopify/semian
         
     | 
| 
       64 
     | 
    
         
            -
            post_install_message: 
         
     | 
| 
      
 64 
     | 
    
         
            +
            post_install_message: |2+
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              ==============================================================================
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              semians is not compatible with redis 5.x.
         
     | 
| 
      
 69 
     | 
    
         
            +
              Update Gemfile to use older redis version:
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  gem "redis", "~> 4.8"
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              ==============================================================================
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       65 
75 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       66 
76 
     | 
    
         
             
            require_paths:
         
     | 
| 
       67 
77 
     | 
    
         
             
            - lib
         
     |