consul-client 0.1.1 → 0.1.2

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: 80c1c93480e61e527b232543f56a88de8ffa42f9
4
- data.tar.gz: abd798f99d22c71b7b382c076dd49d34ad1ecf7e
3
+ metadata.gz: 2e6ef0af86e0e5beeb6d9e18927c6a9ca8dfd9f7
4
+ data.tar.gz: 74d5718e0bddd2d18a4db0897eb22c6db92790d5
5
5
  SHA512:
6
- metadata.gz: 57384907747b902ffb6638288097d6d020f3132e3c6698bb3ab83cc3694488688c282af15f6c233a3e07f5ce8a333191c660b3021c85537baecb69bffc7078df
7
- data.tar.gz: da619c7990bd303b3e46af46c9a5bfb7eb02511315bc6300d6dc9248d67991d4d2bc123a021feca54fa5255d617341143fa8ac4b7dee0fabdfb4bc47019adf22
6
+ metadata.gz: 60032387daf1ec10aa55e1e968075daa651caf230bf4507097a47bd5bb12f97d1f14bfd221ce51c9148cef62714817c49ce2657cc97c7d12853c4251899e90ea
7
+ data.tar.gz: 44f794044862c1112c954c22b8d25704ac714cbae00f732b3e1747ad73993074e07023787d6f87c867b2b55b6e7c7f5716975d9b95ef81151b5e5e4fb00eda4c
@@ -22,6 +22,6 @@ Gem::Specification.new do |gem|
22
22
  gem.name = "consul-client"
23
23
  gem.require_paths = ["lib"]
24
24
  gem.license = "Apache 2.0"
25
- gem.version = '0.1.1'
25
+ gem.version = '0.1.2'
26
26
  gem.has_rdoc = false
27
27
  end
@@ -31,7 +31,7 @@ module Consul
31
31
  # @example
32
32
  # local = Consul::Client.v1.local_service('web')
33
33
  # local.coordinated_shutdown! { $healthy = false }
34
- def local_service(name, http: http, logger: http.logger)
34
+ def local_service(name, http:Consul::Client.v1.http(), logger:http.logger)
35
35
  LocalService.new(name, http: http, logger: logger)
36
36
  end
37
37
 
@@ -56,7 +56,7 @@ module Consul
56
56
  check = ->{
57
57
  uri = URI.parse(url)
58
58
  uri.query ||= ""
59
- uri.query += "&index=#{index}&wait=10s"
59
+ uri.query += "&index=#{index}&wait=60s"
60
60
  logger.debug("GET #{uri}")
61
61
 
62
62
  response = http_request(:get, uri)
@@ -9,8 +9,8 @@ module Consul
9
9
  # @api private
10
10
  def initialize(name, http:, logger:)
11
11
  @name = name
12
- @consul = consul
13
- consul.logger = logger
12
+ @consul = http
13
+ @consul.logger = logger
14
14
  end
15
15
 
16
16
  # Coordinate the shutdown of this node with the rest of the cluster so
@@ -6,7 +6,7 @@ module Consul
6
6
  # @see Consul::Client::V1#service
7
7
  class Service
8
8
  # @api private
9
- def initialize(name, consul: Consul::Client.v1)
9
+ def initialize(name, consul: Consul::Client.v1.http)
10
10
  @name = name
11
11
  @consul = consul
12
12
  end
@@ -20,10 +20,10 @@ module Consul
20
20
  # so make sure it does not conflict with other names. For
21
21
  # instance, the leader lock for the +web+ service would be
22
22
  # stored at +/kv/web/leader+.
23
- def lock(key, &block)
23
+ def lock(key, checks: ["service:#{name}"], &block)
24
24
  session = consul.put("/session/create",
25
25
  LockDelay: '3s',
26
- Checks: ["service:#{name}", "serfHealth"]
26
+ Checks: ["serfHealth"] + checks
27
27
  )["ID"]
28
28
  loop do
29
29
  locked = consul.put("/kv/#{name}/#{key}?acquire=#{session}")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Shay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2016-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client library for Consul HTTP API.
14
14
  email:
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  version: '0'
44
44
  requirements: []
45
45
  rubyforge_project:
46
- rubygems_version: 2.2.2
46
+ rubygems_version: 2.4.5
47
47
  signing_key:
48
48
  specification_version: 4
49
49
  summary: Ruby client library for Consul HTTP API, providing both a thin wrapper around