attache 1.1.1 → 1.1.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 +1 -1
- data/lib/attache/download.rb +20 -10
- data/lib/attache/version.rb +1 -1
- 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: ed983d0f82a9272db5f51699ad336baa2a007931
|
4
|
+
data.tar.gz: 5b1642a3c9ffb783f75c40ac49e01dc1fb3fc02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab88eaa04aba0643c3573f2740b3f1e785bd0adaad6d9bce2b335046677cec85d2198419b5224c6aeba08536bfc50d61734932be5af3f3f118195ee93438af8
|
7
|
+
data.tar.gz: ed3f27711b4f149b15fc68ffb50ae884c9906d4a399e1aa22cbad0fc6757d30c7412758f3ce1a953843dac3b0e9a3cc0b75cabf47e702e8283553f6434c4ab59
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ You can run your own instance on your own Heroku server
|
|
16
16
|
docker run -it -p 9292:5000 --rm attache/attache
|
17
17
|
```
|
18
18
|
|
19
|
-
Also, see [
|
19
|
+
Also, see [Deploying Attache on Digital Ocean using Docker](https://github.com/choonkeat/attache/wiki/Deploying-Attache-on-Digital-Ocean-using-Docker)
|
20
20
|
|
21
21
|
#### Source code
|
22
22
|
|
data/lib/attache/download.rb
CHANGED
@@ -28,7 +28,18 @@ class Attache::Download < Attache::Base
|
|
28
28
|
cachekey = File.join(request_hostname(env), relpath)
|
29
29
|
Attache.cache.fetch(cachekey) do
|
30
30
|
get_first_result_async(vhosts.inject({}) {|sum,(k,v)|
|
31
|
-
|
31
|
+
if v
|
32
|
+
sum.merge("#{k} #{relpath}" => lambda {
|
33
|
+
begin
|
34
|
+
v.storage_get(relpath: relpath)
|
35
|
+
rescue Exception
|
36
|
+
Attache.logger.info "[POOL] not found #{k} #{relpath}"
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
})
|
40
|
+
else
|
41
|
+
sum
|
42
|
+
end
|
32
43
|
})
|
33
44
|
end
|
34
45
|
rescue Exception # Errno::ECONNREFUSED, OpenURI::HTTPError, Excon::Errors, Fog::Errors::Error
|
@@ -92,15 +103,14 @@ class Attache::Download < Attache::Base
|
|
92
103
|
threads = name_code_pairs.collect {|name, code|
|
93
104
|
Thread.new do
|
94
105
|
Thread.handle_interrupt(BasicObject => :on_blocking) { # if killed
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
ensure
|
106
|
+
if result
|
107
|
+
# war over
|
108
|
+
elsif current_result = code.call
|
109
|
+
result = current_result
|
110
|
+
(threads - [Thread.current]).each(&:kill) # kill siblings
|
111
|
+
Attache.logger.info "[POOL] found #{name.inspect}"
|
112
|
+
else
|
113
|
+
# no contribution
|
104
114
|
end
|
105
115
|
}
|
106
116
|
end
|
data/lib/attache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- choonkeat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|