filecluster 0.5.12 → 0.5.13
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 +4 -4
- data/lib/daemon/copy_task_thread.rb +14 -4
- data/lib/fc/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: 55c62eefa42ab98952d048ba96e7467a4a88fd80
|
4
|
+
data.tar.gz: 6f9464f3d84c270a9ed46f84790dc605be33f72d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff5af3f5f2c994df7bf18c191e7d4ad38c6c2f7bf79e43ac2f3ff2011ef49717d26b174d83a01d115f932c396f59a392e0dd98ca2a870d1b10ff873c2220a8a2
|
7
|
+
data.tar.gz: a4934117b805502c5f5b7ca0cf6d496455326f90c57e1587bf03a7bd913bea45b72a172e4f078182d97a7e16158c00d62f65d12b98831b539cfa5d4e08c29dee
|
@@ -44,12 +44,22 @@ class CopyTaskThread < BaseThread
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
return nil unless item && item.status == 'ready'
|
47
|
-
|
48
|
-
|
49
|
-
$
|
47
|
+
available_src_storages = FC::ItemStorage.where("item_id = ? AND status = 'ready'", item.id)
|
48
|
+
.map do |item_storage|
|
49
|
+
$all_storages.detect { |a_storage| a_storage.name == item_storage.storage_name && a_storage.up? }
|
50
|
+
end.compact
|
51
|
+
|
52
|
+
# pref for current host
|
53
|
+
src_storage = available_src_storages.detect { |src| src.host == storage.host }
|
54
|
+
# pref for same dc
|
55
|
+
src_storage = available_src_storages.detect { |src| src.dc == storage.dc } unless src_storage
|
56
|
+
# random from available storages
|
57
|
+
src_storage = available_src_storages.sample unless src_storage
|
58
|
+
|
59
|
+
unless src_storage
|
60
|
+
$log.warn("Item ##{item.id} #{item.name} has no ready item_storage or storage")
|
50
61
|
return nil
|
51
62
|
end
|
52
|
-
src_storage = $all_storages.detect{|s| s.name == src_item_storage.storage_name}
|
53
63
|
$log.debug("Copy from #{src_storage.name} to #{storage.name} #{storage.path}#{item.name}")
|
54
64
|
item.copy_item_storage(src_storage, storage, task, false, speed_limit)
|
55
65
|
rescue Exception => e
|
data/lib/fc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filecluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|