lusnoc 0.1.2.16587 → 1.0.0.70325
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -8
- data/lib/lusnoc/session.rb +1 -1
- data/lib/lusnoc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb34cf9c0298c287853840b632bba99c26366c00d22c6707edff4c100c79b6ea
|
4
|
+
data.tar.gz: ff3cf1b6d5db904261f0e6ecceb3393ba9e5ea14b408bf8150a816fd2ac6ee55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe4689e9edf5be69f6d0c881c2ac3ad40248e649164347c4bcba6134530d38bbe4aa90fe187ffba4f7452f85a9f8c9e766194f69b32c0586ab00392c9b3b65f
|
7
|
+
data.tar.gz: 7cde1cc5d3617a4de67958528b07cf2ab7a81faa04653174df8c654375c3c090b4de483a3fd024620e8bdbaf28320b79070260ce0d5a75e00b59619d0e5ba542
|
data/README.md
CHANGED
@@ -4,14 +4,15 @@
|
|
4
4
|
[![Gem](https://img.shields.io/gem/dt/lusnoc.svg)](https://rubygems.org/gems/lusnoc/versions)
|
5
5
|
[![YARD](https://badgen.net/badge/YARD/doc/blue)](http://www.rubydoc.info/gems/lusnoc)
|
6
6
|
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![
|
10
|
-
[![
|
11
|
-
[![Vulnerabilities](https://lysander.x.rnds.pro/api/v1/badges/lusnoc_vulnerable.svg)](https://lysander.x.rnds.pro/api/v1/badges/lusnoc_vulnerable.html)
|
7
|
+
[![Coverage](https://lysander.rnds.pro/api/v1/badges/lusnoc_coverage.svg)](https://lysander.rnds.pro/api/v1/badges/lusnoc_coverage.html)
|
8
|
+
[![Quality](https://lysander.rnds.pro/api/v1/badges/lusnoc_quality.svg)](https://lysander.rnds.pro/api/v1/badges/lusnoc_quality.html)
|
9
|
+
[![Outdated](https://lysander.rnds.pro/api/v1/badges/lusnoc_outdated.svg)](https://lysander.rnds.pro/api/v1/badges/lusnoc_outdated.html)
|
10
|
+
[![Vulnerabilities](https://lysander.rnds.pro/api/v1/badges/lusnoc_vulnerable.svg)](https://lysander.rnds.pro/api/v1/badges/lusnoc_vulnerable.html)
|
12
11
|
|
13
12
|
Lusnoc is reliable gem to deal with [Consul](https://www.consul.io). It is designed to be simple and work without dark background magic.
|
14
|
-
It is inspired by [consul-mutex](https://github.com/
|
13
|
+
It is inspired by [consul-mutex](https://github.com/kinnalru/consul-mutex)(which has hard background magic).
|
14
|
+
|
15
|
+
Article about gem: https://blog.rnds.pro/lusnoc (in russian)
|
15
16
|
|
16
17
|
## FAQ
|
17
18
|
|
@@ -19,7 +20,7 @@ It is inspired by [consul-mutex](https://github.com/discourse/consul-mutex)(whic
|
|
19
20
|
|
20
21
|
Lusnoc allows you to interact with Consul to provide distributed locks(mutex) to your application.
|
21
22
|
|
22
|
-
#### What's the difference between lusnoc and [consul-mutex](https://github.com/
|
23
|
+
#### What's the difference between lusnoc and [consul-mutex](https://github.com/kinnalru/consul-mutex) or [diplomat](https://github.com/WeAreFarmGeek/diplomat)
|
23
24
|
* consul-mutex starts background thread and ***the block of code that you pass to #synchronize runs on a separate thread, and can be killed without warning if the mutex determines that it no longer holds the lock.***
|
24
25
|
* diplomat provides the basic session/locks functionality but no automated control over it
|
25
26
|
|
@@ -44,7 +45,7 @@ TTL will be used in session creation on `#synchronize`:
|
|
44
45
|
puts "We are exclusively owns resource"
|
45
46
|
end
|
46
47
|
```
|
47
|
-
If mutex cannot be acquired within given timeout Lusnoc::TimeoutError is raised.
|
48
|
+
If mutex cannot be acquired within given timeout `Lusnoc::TimeoutError` is raised.
|
48
49
|
By default, the "value" of the lock resource will be the hostname of the
|
49
50
|
machine that it's running on (so you know who has the lock). If, for some
|
50
51
|
reason, you'd like to set the value to something else, you can do that, too:
|
data/lib/lusnoc/session.rb
CHANGED
@@ -63,7 +63,7 @@ module Lusnoc
|
|
63
63
|
def create_session(name, ttl)
|
64
64
|
resp = Lusnoc.http_put(build_url('/v1/session/create'),
|
65
65
|
{ Name: name, TTL: "#{ttl}s", LockDelay: '5s' },
|
66
|
-
{ timeout: 1 })
|
66
|
+
**{ timeout: 1 })
|
67
67
|
session_id = JSON.parse(resp.body)['ID']
|
68
68
|
@expired_at = Time.now + ttl
|
69
69
|
logger.info "Session[#{name}:#{session_id}] created. TTL:#{ttl}s. Next expiration: #{@expired_at}"
|
data/lib/lusnoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lusnoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.70325
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoilenko Yuri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|