bridge_cache 0.3.17 → 0.3.19
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e0ef250eb9395352435e1651e2e2f64c9233ec7446dde9d93525c0cf26b7542
|
4
|
+
data.tar.gz: a7b54fef68c133c6a6012ccbf7ab7df18ecc73dadca293695456250dcd10c644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05824d1406cec5c682f470d4cb4d3710ecff169a95add65899e345379b5f72317ed645548e04e4f276da1b72124c07ed40d3eb8fc6eb76c5490ecd5a31942008'
|
7
|
+
data.tar.gz: 166dc215b08233ff207146b5a6d9b831de4e5f6747c4a94a84278f4c561ea740c4ebb11af4b5e8b9a839f21cee36b52e9184f892af33373a77cdf863f8c33775
|
@@ -5,17 +5,24 @@ module BridgeCache::Jobs
|
|
5
5
|
|
6
6
|
ATTEMPTS_THRESHOLD = 30
|
7
7
|
|
8
|
-
def
|
9
|
-
account_settings
|
10
|
-
|
8
|
+
def remote_data
|
9
|
+
@remote_data ||= BridgeBlueprint::RemoteData.new(@account_settings[:url], @account_settings[:api_key], @account_settings[:api_secret])
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform(account_settings, attempts, chain = [], retries = 0)
|
13
|
+
@account_settings = account_settings.with_indifferent_access
|
11
14
|
if attempts > ATTEMPTS_THRESHOLD
|
12
15
|
Rails.logger.fatal("Bridge data dump failed to download after #{(ATTEMPTS_THRESHOLD * 30) / 60} minutes")
|
13
16
|
elsif remote_data.status == BridgeBlueprint::Constants::STATUS_COMPLETE
|
14
|
-
BridgeCache::Jobs::ImportData.set(queue: queue_name).perform_later(account_settings, chain)
|
17
|
+
BridgeCache::Jobs::ImportData.set(queue: queue_name).perform_later(@account_settings, chain)
|
15
18
|
elsif remote_data.status == BridgeBlueprint::Constants::STATUS_PENDING
|
16
|
-
BridgeCache::Jobs::ImportCheck.set(queue: queue_name, wait: 30.seconds).perform_later(account_settings, attempts + 1, chain)
|
19
|
+
BridgeCache::Jobs::ImportCheck.set(queue: queue_name, wait: 30.seconds).perform_later(@account_settings, attempts + 1, chain)
|
17
20
|
elsif remote_data.status == BridgeBlueprint::Constants::STATUS_FAILED || remote_data.status == BridgeBlueprint::Constants::STATUS_NOT_FOUND
|
18
|
-
|
21
|
+
if retries < 1
|
22
|
+
raise 'Bridge data dump download failed'
|
23
|
+
else
|
24
|
+
BridgeCache::Jobs::ImportStart.set(queue: queue_name).perform_later(@account_settings, chain, retries - 1)
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
@@ -2,7 +2,7 @@ module BridgeCache::Jobs
|
|
2
2
|
class ImportStart < ActiveJob::Base
|
3
3
|
queue_as :default
|
4
4
|
|
5
|
-
def perform(account_settings, chain = [])
|
5
|
+
def perform(account_settings, chain = [], retries = 0)
|
6
6
|
data = BridgeBlueprint::RemoteData.new(account_settings[:url], account_settings[:api_key], account_settings[:api_secret])
|
7
7
|
data.start_data_report
|
8
8
|
BridgeCache::Jobs::ImportCheck
|
@@ -10,7 +10,8 @@ module BridgeCache::Jobs
|
|
10
10
|
.perform_later(
|
11
11
|
account_settings,
|
12
12
|
0,
|
13
|
-
chain
|
13
|
+
chain,
|
14
|
+
retries
|
14
15
|
)
|
15
16
|
end
|
16
17
|
end
|
data/lib/bridge_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridge_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jshaffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-import
|