bridge_cache 0.3.13 → 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 +4 -4
- data/app/lib/bridge_cache/jobs/import_check.rb +13 -6
- data/app/lib/bridge_cache/jobs/import_data.rb +2 -1
- data/app/lib/bridge_cache/jobs/import_start.rb +3 -2
- data/db/migrate/20180925210056_add_bridge_timestamps_to_bridge_models.rb +1 -0
- data/db/migrate/20200717142423_add_hris_id_to_bridge_cache_users.rb +6 -0
- data/db/migrate/20201102153622_change_external_course_id_to_string.rb +5 -0
- data/lib/bridge_cache/version.rb +1 -1
- metadata +9 -13
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
|
@@ -10,7 +10,8 @@ module BridgeCache::Jobs
|
|
10
10
|
path = "#{dir}/data_dump"
|
11
11
|
remote_data.store_file(path)
|
12
12
|
import = BridgeBlueprint::DataDump.new(path)
|
13
|
-
BridgeCache.resolved_models(account_settings[:is_subaccount])
|
13
|
+
models = account_settings[:models] || BridgeCache.resolved_models(account_settings[:is_subaccount])
|
14
|
+
models.each do |model|
|
14
15
|
ids = []
|
15
16
|
ids << BridgeCache::Plugins::CSVDump.bulk_import(import, model)
|
16
17
|
BridgeCache::Jobs::CleanupJob.set(queue: queue_name).perform_later(model, ids)
|
@@ -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
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class AddBridgeTimestampsToBridgeModels < ActiveRecord::Migration[5.1]
|
2
2
|
def change
|
3
|
+
return unless BridgeCache.use_internal_database
|
3
4
|
add_column :bridge_cache_affiliated_sub_accounts, :bridge_created_at, :datetime
|
4
5
|
add_column :bridge_cache_course_templates, :bridge_created_at, :datetime
|
5
6
|
add_column :bridge_cache_custom_fields, :bridge_created_at, :datetime
|
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
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-import
|
@@ -56,20 +56,14 @@ dependencies:
|
|
56
56
|
name: rein
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.4'
|
62
|
-
- - "~>"
|
59
|
+
- - ">="
|
63
60
|
- !ruby/object:Gem::Version
|
64
61
|
version: 3.4.0
|
65
62
|
type: :runtime
|
66
63
|
prerelease: false
|
67
64
|
version_requirements: !ruby/object:Gem::Requirement
|
68
65
|
requirements:
|
69
|
-
- - "
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '3.4'
|
72
|
-
- - "~>"
|
66
|
+
- - ">="
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: 3.4.0
|
75
69
|
- !ruby/object:Gem::Dependency
|
@@ -267,6 +261,8 @@ files:
|
|
267
261
|
- db/migrate/20180801162929_create_bridge_cache_hosts.rb
|
268
262
|
- db/migrate/20180925210056_add_bridge_timestamps_to_bridge_models.rb
|
269
263
|
- db/migrate/20190801163930_create_user_course_visits.rb
|
264
|
+
- db/migrate/20200717142423_add_hris_id_to_bridge_cache_users.rb
|
265
|
+
- db/migrate/20201102153622_change_external_course_id_to_string.rb
|
270
266
|
- lib/bridge_cache.rb
|
271
267
|
- lib/bridge_cache/engine.rb
|
272
268
|
- lib/bridge_cache/version.rb
|
@@ -275,7 +271,7 @@ homepage: https://www.getbridge.com
|
|
275
271
|
licenses:
|
276
272
|
- MIT
|
277
273
|
metadata: {}
|
278
|
-
post_install_message:
|
274
|
+
post_install_message:
|
279
275
|
rdoc_options: []
|
280
276
|
require_paths:
|
281
277
|
- lib
|
@@ -291,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
287
|
version: '0'
|
292
288
|
requirements: []
|
293
289
|
rubygems_version: 3.0.3
|
294
|
-
signing_key:
|
290
|
+
signing_key:
|
295
291
|
specification_version: 4
|
296
292
|
summary: A mountable engine for bridge data storage
|
297
293
|
test_files: []
|