nexus_seed 0.2.17 → 0.2.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/lib/nexus_seed/base.rb +8 -8
- data/lib/nexus_seed/version.rb +2 -2
- data/lib/nexus_seed.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc10e398d21ca9cb8f7ba442f40789a7b6aa7974022abf0d1700a103345a1edb
|
|
4
|
+
data.tar.gz: 3ba08b3837e68ecedd36c9501b027f93fc29c8034f805a83452f6fc802c28567
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21fc4402557c8b570cba3334644d35672bf826999cb0488a547e4b6a749206adac4ce4b3286b60060a55fe74a94aa5745e28bb9cebd418853bebb063fe1ce12d
|
|
7
|
+
data.tar.gz: d1a674650a79a54ead3ad69ad06895e23fea420b08e908f9d546724ad01922ad1e00575519710755f8e97d1feb95667d069ab4a7c09cb88f6077b6f4a5775ae0
|
data/lib/nexus_seed/base.rb
CHANGED
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
module NexusSeed
|
|
3
3
|
class Base < ActiveRecord::Base
|
|
4
4
|
def self.transaction(**options, &block)
|
|
5
|
-
super
|
|
6
|
-
|
|
7
|
-
NexusSeed::Builder.seed_report
|
|
8
|
-
|
|
9
|
-
if ENV['NEXUS_SEED_DESTROY'] == 'true'
|
|
10
|
-
NexusSeed::Builder.destroy_seeds
|
|
11
|
-
end
|
|
12
|
-
|
|
13
5
|
# Reset table sequences. Apparently rails loses track of a pk sequence if the pk value is inserted manually, e.g
|
|
14
6
|
# User.new(id: 1).save. When subsequently running User.create(), ActiveRecord should increment the id value to 2
|
|
15
7
|
# by default, but turns out it will try to insert id: 1 again which will result in an error.
|
|
@@ -18,6 +10,14 @@ module NexusSeed
|
|
|
18
10
|
ActiveRecord::Base.connection.tables.each do |t|
|
|
19
11
|
ActiveRecord::Base.connection.reset_pk_sequence!(t)
|
|
20
12
|
end
|
|
13
|
+
|
|
14
|
+
super
|
|
15
|
+
|
|
16
|
+
NexusSeed::Builder.seed_report
|
|
17
|
+
|
|
18
|
+
if ENV['NEXUS_SEED_DESTROY'] == 'true'
|
|
19
|
+
NexusSeed::Builder.destroy_seeds
|
|
20
|
+
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
data/lib/nexus_seed/version.rb
CHANGED
data/lib/nexus_seed.rb
CHANGED
|
@@ -42,7 +42,8 @@ module NexusSeed
|
|
|
42
42
|
|
|
43
43
|
elsif retries >= retry_limit && retry_limit != 0
|
|
44
44
|
# log error stating seeding could not complete and task details
|
|
45
|
-
logger.warn('limit reached')
|
|
45
|
+
logger.warn('Retry limit reached.')
|
|
46
|
+
abort('Seed task timeout.')
|
|
46
47
|
|
|
47
48
|
else
|
|
48
49
|
# sleep and increment retries
|
|
@@ -51,16 +52,18 @@ module NexusSeed
|
|
|
51
52
|
self.retries = retries + 1
|
|
52
53
|
|
|
53
54
|
# log retry attempts
|
|
54
|
-
logger.warn("
|
|
55
|
+
logger.warn("Retrying after #{sleep_interval}s. Retry #{retries} of #{retry_limit}")
|
|
55
56
|
|
|
56
57
|
# call itself
|
|
57
58
|
_run_internal
|
|
58
59
|
end
|
|
59
60
|
else
|
|
60
61
|
logger.error('Will not seed in this rails env.', env: Rails.env)
|
|
62
|
+
abort('Seed task incorrect environment.')
|
|
61
63
|
end
|
|
62
64
|
rescue => e
|
|
63
65
|
logger.error('Error during seed task.', exception: e)
|
|
66
|
+
abort('Seed task error.')
|
|
64
67
|
end
|
|
65
68
|
|
|
66
69
|
# retry limit
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nexus_seed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Johnathon Harris
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-05-
|
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nexus_semantic_logger
|