aranha-rails 0.8.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4546fc37349ab787296582e2b386dc4d46480153c6e1b57eabb713bba0b7d780
4
- data.tar.gz: f9ea21b8995475f02ca4681c5e37a23120b76518a989d5431db75c3aef6f5926
3
+ metadata.gz: df34de5939413cf8b0a8ac9a8185e06551953226a69ac9fafb08ed04b9ac8679
4
+ data.tar.gz: 8494ebfc1b7038fb91e076f50607eeb4543f47d128401b66ffd85b332e8094ff
5
5
  SHA512:
6
- metadata.gz: 9bdca2a251072342e3848461faaabff5f65d233bb1093b3c10e1f2df791fb0b56ce5258c5fced59213f201c0b639e92f5ce7109edf909cf4c501d9936b73d43c
7
- data.tar.gz: fb3df58fbe7d46f971be3143211c914215217258ff421acdf58872513a885c6cb647350b78b8310b3f82dace20cb146b93802695f00a83c9dc90b65adbbde0e7
6
+ metadata.gz: 7a4cd710166a2d1ed26c3e10f6b60821cc59b04884e4348ed1065230dbe958f7e1fe6075230432336770a3e0e31b6408de9cb89e542a484d0e6a7f7509f688c2
7
+ data.tar.gz: 02d01c2175b85069755f45a2c59e1043d7f49922d8a8dd0eaec687a34d1cb496e54d4b1363893029d404d8727bca2549c8f91ca4b5d68f917c5f3f24177433f1
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'aranha/address_processor'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Aranha
@@ -11,6 +11,8 @@ module Aranha
11
11
  module Scheduling
12
12
  common_concern
13
13
 
14
+ DEFAULT_PRIORITY = 0
15
+
14
16
  module ClassMethods
15
17
  # @return [Array<Aranha::Address>]
16
18
  def expired(time = ::Time.zone.now)
@@ -24,7 +26,8 @@ module Aranha
24
26
 
25
27
  job = ::Delayed::Job.enqueue(
26
28
  ::Aranha::Address::DelayedJob.new(id),
27
- queue: ::Aranha::Rails::Process::QUEUE
29
+ queue: ::Aranha::Rails::Process::QUEUE,
30
+ priority: priority
28
31
  )
29
32
  update!(delayed_job: job)
30
33
  end
@@ -43,6 +46,10 @@ module Aranha
43
46
  tries_count < ::Aranha::Processor::DEFAULT_MAX_TRIES
44
47
  end
45
48
 
49
+ def priority
50
+ processor_configuration.if_present(DEFAULT_PRIORITY, &:priority)
51
+ end
52
+
46
53
  def schedule?
47
54
  processed_at.blank? && allow_retry? && delayed_job.blank? && enabled?
48
55
  end
@@ -31,6 +31,7 @@ module Aranha
31
31
  end
32
32
  end
33
33
 
34
+ validates :priority, numericality: { only_integer: true }
34
35
  validates :processor_class, presence: true
35
36
  validate :processor_class_in_list
36
37
  validates :timeout_seconds, allow_blank: true,
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddPriorityToAranhaProcessorConfigurations < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :aranha_processor_configurations, :priority, :integer, default: 0, null: false
6
+ end
7
+ end
@@ -43,7 +43,7 @@ module Aranha
43
43
  end
44
44
 
45
45
  def unprocessed_addresses
46
- ::Aranha::Address.all.select(&:schedule?)
46
+ ::Aranha::Address.all.select(&:schedule?).sort_by { |a| [a.priority] }
47
47
  end
48
48
  end
49
49
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Rails
5
- VERSION = '0.8.3'
5
+ VERSION = '0.9.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aranha-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2023-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha
@@ -16,60 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.17'
19
+ version: '0.19'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.17.1
22
+ version: 0.19.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.17'
29
+ version: '0.19'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.17.1
32
+ version: 0.19.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: aranha-parsers
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.14'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 0.14.3
39
+ version: '0.20'
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
44
  - - "~>"
48
45
  - !ruby/object:Gem::Version
49
- version: '0.14'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.14.3
46
+ version: '0.20'
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: eac_active_scaffold
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '0.2'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 0.2.3
53
+ version: '0.3'
63
54
  type: :runtime
64
55
  prerelease: false
65
56
  version_requirements: !ruby/object:Gem::Requirement
66
57
  requirements:
67
58
  - - "~>"
68
59
  - !ruby/object:Gem::Version
69
- version: '0.2'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 0.2.3
60
+ version: '0.3'
73
61
  - !ruby/object:Gem::Dependency
74
62
  name: eac_rails_delayed_job
75
63
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +67,7 @@ dependencies:
79
67
  version: '0.1'
80
68
  - - ">="
81
69
  - !ruby/object:Gem::Version
82
- version: 0.1.3
70
+ version: 0.1.4
83
71
  type: :runtime
84
72
  prerelease: false
85
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,41 +77,41 @@ dependencies:
89
77
  version: '0.1'
90
78
  - - ">="
91
79
  - !ruby/object:Gem::Version
92
- version: 0.1.3
80
+ version: 0.1.4
93
81
  - !ruby/object:Gem::Dependency
94
82
  name: eac_rails_utils
95
83
  requirement: !ruby/object:Gem::Requirement
96
84
  requirements:
97
85
  - - "~>"
98
86
  - !ruby/object:Gem::Version
99
- version: '0.17'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 0.17.1
87
+ version: '0.18'
103
88
  type: :runtime
104
89
  prerelease: false
105
90
  version_requirements: !ruby/object:Gem::Requirement
106
91
  requirements:
107
92
  - - "~>"
108
93
  - !ruby/object:Gem::Version
109
- version: '0.17'
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: 0.17.1
94
+ version: '0.18'
113
95
  - !ruby/object:Gem::Dependency
114
96
  name: eac_ruby_utils
115
97
  requirement: !ruby/object:Gem::Requirement
116
98
  requirements:
117
99
  - - "~>"
118
100
  - !ruby/object:Gem::Version
119
- version: '0.104'
101
+ version: '0.117'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 0.117.1
120
105
  type: :runtime
121
106
  prerelease: false
122
107
  version_requirements: !ruby/object:Gem::Requirement
123
108
  requirements:
124
109
  - - "~>"
125
110
  - !ruby/object:Gem::Version
126
- version: '0.104'
111
+ version: '0.117'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 0.117.1
127
115
  - !ruby/object:Gem::Dependency
128
116
  name: rails
129
117
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +178,7 @@ files:
190
178
  - db/migrate/20210721185222_add_last_error_to_aranha_addresses.rb
191
179
  - db/migrate/20210814220540_create_aranha_processor_configurations.rb
192
180
  - db/migrate/20210815160543_add_enabled_to_aranha_processor_configurations.rb
181
+ - db/migrate/20230602212759_add_priority_to_aranha_processor_configurations.rb
193
182
  - lib/aranha/rails.rb
194
183
  - lib/aranha/rails/engine.rb
195
184
  - lib/aranha/rails/fixtures_download.rb