ksconnect 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a505bbbcecb0dd7e64773f05cd2ebd1c0c8a8ca8
4
- data.tar.gz: 627e5470e67045f5b80e4348246e1096739e90c6
3
+ metadata.gz: 6853d3cfdcfbee0b4a0c2f294cf457a5e6c78486
4
+ data.tar.gz: 87a75e96b2a26b969f326409e77c41334713ca6b
5
5
  SHA512:
6
- metadata.gz: 2329d4fa03f93cc92ec997b9640b3c8a982d115543dd7d775e2ba081f784ba70154a7ea1f1700b02eda5a23173f20df59719861a4fc582086de5dfa122a5ecff
7
- data.tar.gz: 4fe484ed83632293487e7bc7c4ba987cdd6648bcb0e68e5e50df083dbd05cef5dbbcae3ab9b1d7e0d797586c6443572ab3b53807a97b289ac1e507303bf3475c
6
+ metadata.gz: 271182ef4a1a6b888cd78eaf3294d1f09c5349f5ee78896437bcaafb83d8ff5526d8dcd40f29e008bb673ac2037a759dd3a087307a469028c47888222b55f889
7
+ data.tar.gz: d5c05575a69ae961a0be87c65cf638632bcb3c5af3a5a5fbdb7a911f66fe27a09779716a44b761d2e044c0ff24abcfb2d072fc91a486fd9e1d8a12b450a3b3e0
@@ -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)
@@ -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
- logger.error e.message
100
- retry unless (tries -= 1).zero?
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.3
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-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis