attache 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b7c3810e65baa28f7f28fc97e86b4754d85484e
4
- data.tar.gz: f3a701ece0b0a1594da9f664a7e48c8c8ad24509
3
+ metadata.gz: ed983d0f82a9272db5f51699ad336baa2a007931
4
+ data.tar.gz: 5b1642a3c9ffb783f75c40ac49e01dc1fb3fc02b
5
5
  SHA512:
6
- metadata.gz: 9b822e68fe861cd1161d9cefa51b9cd39d885aabb273e90618bc4c40858df791c1e73f76cb49332c02cf06f1570bd254d0025d83c06fc452eb71b192f18725b0
7
- data.tar.gz: a7f05f0702b149cc1fa81805c8408686d485a9f6fcb5446623f4dc4a406c17f5985f4834b23778aee1cea1b67f2bc03b10d7a69358df6325d1083ca9f74c1ef6
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 [deploying attache on digital ocean in 5 minutes](https://github.com/choonkeat/attache/wiki/Deploying-Attache-on-Digital-Ocean)
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
 
@@ -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
- v ? sum.merge("#{k} #{relpath}" => lambda { v.storage_get(relpath: relpath) }) : sum
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
- begin
96
- if current_result = code.call
97
- result = current_result
98
- (threads - [Thread.current]).each(&:kill) # kill siblings
99
- Attache.logger.info "[POOL] found #{name.inspect}"
100
- end
101
- rescue Exception
102
- Attache.logger.info "[POOL] not found #{name.inspect}"
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
@@ -1,3 +1,3 @@
1
1
  module Attache
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
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.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-16 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack