ksconnect 0.2.3 → 0.2.4
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/lib/ksconnect.rb +2 -2
 - data/lib/ksconnect/api/plugin.rb +0 -8
 - data/lib/ksconnect/api/plugin/data.rb +6 -2
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6853d3cfdcfbee0b4a0c2f294cf457a5e6c78486
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 87a75e96b2a26b969f326409e77c41334713ca6b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 271182ef4a1a6b888cd78eaf3294d1f09c5349f5ee78896437bcaafb83d8ff5526d8dcd40f29e008bb673ac2037a759dd3a087307a469028c47888222b55f889
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d5c05575a69ae961a0be87c65cf638632bcb3c5af3a5a5fbdb7a911f66fe27a09779716a44b761d2e044c0ff24abcfb2d072fc91a486fd9e1d8a12b450a3b3e0
         
     | 
    
        data/lib/ksconnect.rb
    CHANGED
    
    | 
         @@ -14,8 +14,8 @@ class KSConnect 
     | 
|
| 
       14 
14 
     | 
    
         
             
              attr_reader :api
         
     | 
| 
       15 
15 
     | 
    
         
             
              attr_reader :plugin
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              MIN_THREADS = ENV['MIN_THREADS'] || 5
         
     | 
| 
       18 
     | 
    
         
            -
              MAX_THREADS = ENV['MAX_THREADS'] || 25
         
     | 
| 
      
 17 
     | 
    
         
            +
              MIN_THREADS = (ENV['MIN_THREADS'] || 5).to_i
         
     | 
| 
      
 18 
     | 
    
         
            +
              MAX_THREADS = (ENV['MAX_THREADS'] || 25).to_i
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              def initialize(*args)
         
     | 
| 
       21 
21 
     | 
    
         
             
                Redis.current ||= Redis.new(driver: :hiredis)
         
     | 
    
        data/lib/ksconnect/api/plugin.rb
    CHANGED
    
    | 
         @@ -107,10 +107,6 @@ class KSConnect 
     | 
|
| 
       107 
107 
     | 
    
         
             
                      else
         
     | 
| 
       108 
108 
     | 
    
         
             
                        raise "Invalid request type"
         
     | 
| 
       109 
109 
     | 
    
         
             
                    end
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                    $redis.with { |redis|
         
     | 
| 
       112 
     | 
    
         
            -
                      redis.publish("core:push", { domain_name: domain_name, plugin_name: @name, request_type: request_type }.to_json) if should_repush?
         
     | 
| 
       113 
     | 
    
         
            -
                    }
         
     | 
| 
       114 
110 
     | 
    
         
             
                  end
         
     | 
| 
       115 
111 
     | 
    
         | 
| 
       116 
112 
     | 
    
         
             
                  def domains_key
         
     | 
| 
         @@ -120,10 +116,6 @@ class KSConnect 
     | 
|
| 
       120 
116 
     | 
    
         | 
| 
       121 
117 
     | 
    
         
             
                  private
         
     | 
| 
       122 
118 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
                  def should_repush?
         
     | 
| 
       124 
     | 
    
         
            -
                    @main_plugin && @name != 'core'
         
     | 
| 
       125 
     | 
    
         
            -
                  end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
119 
     | 
    
         
             
                  def get_ip_for(domain_name)
         
     | 
| 
       128 
120 
     | 
    
         
             
                    $redis.with { |redis| redis.hget(domains_key, domain_name) }
         
     | 
| 
       129 
121 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -96,8 +96,12 @@ class KSConnect 
     | 
|
| 
       96 
96 
     | 
    
         
             
                            raise "Race on setting data key failed." unless redis.hsetnx("#{@plugin_name}:#{@type}", @domain_name, @cache_uuid)
         
     | 
| 
       97 
97 
     | 
    
         
             
                          end
         
     | 
| 
       98 
98 
     | 
    
         
             
                        rescue Exception => e
         
     | 
| 
       99 
     | 
    
         
            -
                           
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 99 
     | 
    
         
            +
                          if (tries -= 1).nonzero?
         
     | 
| 
      
 100 
     | 
    
         
            +
                            logger.warn e.message
         
     | 
| 
      
 101 
     | 
    
         
            +
                            retry
         
     | 
| 
      
 102 
     | 
    
         
            +
                          else
         
     | 
| 
      
 103 
     | 
    
         
            +
                            raise e # re-raise if can't get uuid after all tries
         
     | 
| 
      
 104 
     | 
    
         
            +
                          end
         
     | 
| 
       101 
105 
     | 
    
         
             
                        end
         
     | 
| 
       102 
106 
     | 
    
         
             
                      }
         
     | 
| 
       103 
107 
     | 
    
         
             
                    end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ksconnect
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ivan Poon
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-03-09 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: redis
         
     |