aranha-rails 0.8.4 → 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: 26eb70930f47095800bebbc88be94c5d44434dc018631e9f03a5783736fc322c
4
- data.tar.gz: 86e7e889983b3d370924e79e8d9127f7fc55845a3bec8205a816493a74e0b522
3
+ metadata.gz: df34de5939413cf8b0a8ac9a8185e06551953226a69ac9fafb08ed04b9ac8679
4
+ data.tar.gz: 8494ebfc1b7038fb91e076f50607eeb4543f47d128401b66ffd85b332e8094ff
5
5
  SHA512:
6
- metadata.gz: f22e1064e807d5fdfcc42a6af3fb4322a7ee74e3824f6536f54d9d71cfb241254a5c74660b4f1123818eec65c34cb513657e7d5ddd3c27a1ccdd9e25af17ad28
7
- data.tar.gz: a4671ab1a659124ce76fb0af5cb2a38933eac2dbba603d984e8b23c8556bfcd93c12e9e51acabcb3dc16dba937a924ee4cf3b238615f0d9136abfcdf0fb77364
6
+ metadata.gz: 7a4cd710166a2d1ed26c3e10f6b60821cc59b04884e4348ed1065230dbe958f7e1fe6075230432336770a3e0e31b6408de9cb89e542a484d0e6a7f7509f688c2
7
+ data.tar.gz: 02d01c2175b85069755f45a2c59e1043d7f49922d8a8dd0eaec687a34d1cb496e54d4b1363893029d404d8727bca2549c8f91ca4b5d68f917c5f3f24177433f1
@@ -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.4'
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.4
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-11-22 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,54 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.18'
19
+ version: '0.19'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.19.2
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '0.18'
29
+ version: '0.19'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.19.2
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: aranha-parsers
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0.14'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.14.4
39
+ version: '0.20'
37
40
  type: :runtime
38
41
  prerelease: false
39
42
  version_requirements: !ruby/object:Gem::Requirement
40
43
  requirements:
41
44
  - - "~>"
42
45
  - !ruby/object:Gem::Version
43
- version: '0.14'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.14.4
46
+ version: '0.20'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: eac_active_scaffold
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.2'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.2.3
53
+ version: '0.3'
57
54
  type: :runtime
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - "~>"
62
59
  - !ruby/object:Gem::Version
63
- version: '0.2'
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.2.3
60
+ version: '0.3'
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: eac_rails_delayed_job
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +67,7 @@ dependencies:
73
67
  version: '0.1'
74
68
  - - ">="
75
69
  - !ruby/object:Gem::Version
76
- version: 0.1.3
70
+ version: 0.1.4
77
71
  type: :runtime
78
72
  prerelease: false
79
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,47 +77,41 @@ dependencies:
83
77
  version: '0.1'
84
78
  - - ">="
85
79
  - !ruby/object:Gem::Version
86
- version: 0.1.3
80
+ version: 0.1.4
87
81
  - !ruby/object:Gem::Dependency
88
82
  name: eac_rails_utils
89
83
  requirement: !ruby/object:Gem::Requirement
90
84
  requirements:
91
85
  - - "~>"
92
86
  - !ruby/object:Gem::Version
93
- version: '0.17'
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.17.1
87
+ version: '0.18'
97
88
  type: :runtime
98
89
  prerelease: false
99
90
  version_requirements: !ruby/object:Gem::Requirement
100
91
  requirements:
101
92
  - - "~>"
102
93
  - !ruby/object:Gem::Version
103
- version: '0.17'
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: 0.17.1
94
+ version: '0.18'
107
95
  - !ruby/object:Gem::Dependency
108
96
  name: eac_ruby_utils
109
97
  requirement: !ruby/object:Gem::Requirement
110
98
  requirements:
111
99
  - - "~>"
112
100
  - !ruby/object:Gem::Version
113
- version: '0.107'
101
+ version: '0.117'
114
102
  - - ">="
115
103
  - !ruby/object:Gem::Version
116
- version: 0.107.1
104
+ version: 0.117.1
117
105
  type: :runtime
118
106
  prerelease: false
119
107
  version_requirements: !ruby/object:Gem::Requirement
120
108
  requirements:
121
109
  - - "~>"
122
110
  - !ruby/object:Gem::Version
123
- version: '0.107'
111
+ version: '0.117'
124
112
  - - ">="
125
113
  - !ruby/object:Gem::Version
126
- version: 0.107.1
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