locker 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/locker/advisory.rb +1 -1
- data/lib/locker/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1623bce6a4448a47c0f7244284c37a68b40a9fb3
|
4
|
+
data.tar.gz: c4b81eada8d4cf229eda2854308da3f7a13d13d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb8b6a9996aeacd61f13101c8c84d0becdddd62caaaa2672f926934fb2f7ea2c5c403d50ff8ceb756c321bf2d9d77eaac2bc4c81ef9fc66bb220e8fa135543e7
|
7
|
+
data.tar.gz: 127921d87034603b81452a88bf578913f5b6cdaac722fd9bb8f05b43ba16c6e7ab05eab3c395b1297f72b8f6f097b538623342c357d36e8be3ca1c8b7b5d6135
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Suppose you have a process running on a server that continually performs a task.
|
|
27
27
|
#### Code (lib/new_feed_checker.rb)
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
|
30
|
+
loop do
|
31
31
|
FeedChecker.check_for_new_feeds
|
32
32
|
end
|
33
33
|
```
|
@@ -49,7 +49,7 @@ This would work fantastic, so long as `FeedChecker.check_for_new_feeds` is safe
|
|
49
49
|
```ruby
|
50
50
|
Locker.run("new-feed-checker") do # One server will get the lock
|
51
51
|
# Only one server will get here
|
52
|
-
|
52
|
+
loop do
|
53
53
|
FeedChecker.check_for_new_feeds
|
54
54
|
end
|
55
55
|
end # Lock is released at this point
|
@@ -68,7 +68,7 @@ This is great! We've made sure that only one server can run the code at any give
|
|
68
68
|
```ruby
|
69
69
|
Locker.run("new-feed-checker", :blocking => true) do
|
70
70
|
# Only one server will get here at a time. The other server will patiently wait.
|
71
|
-
|
71
|
+
loop do
|
72
72
|
FeedChecker.check_for_new_feeds
|
73
73
|
end
|
74
74
|
end # Lock is released at this point
|
@@ -150,7 +150,7 @@ end
|
|
150
150
|
In our use we've settled on a common pattern, one that lets us distribute the load of our processes between our application and/or utility servers while making sure we have no single point of failure. This means that no single server going down (except the database) will stop the code from executing. Continuing from the code above, we'll use the example of the RSS/Atom feed checker, `FeedChecker.check_for_new_feeds`. To improve on the previous examples, we'll make the code rotate among our servers, so over a long enough time period each server will have spent an equal amount of time running the task.
|
151
151
|
|
152
152
|
```ruby
|
153
|
-
|
153
|
+
loop do
|
154
154
|
Locker.run("new-feed-checker", :blocking => true) do
|
155
155
|
FeedChecker.check_for_new_feeds
|
156
156
|
end
|
data/lib/locker/advisory.rb
CHANGED
data/lib/locker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sutton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project: locker
|
117
|
-
rubygems_version: 2.4.
|
117
|
+
rubygems_version: 2.4.8
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Locker is a locking mechanism for limiting the concurrency of ruby code using
|