aranha-rails 0.7.2 → 0.8.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7549d708d366c904799577c0b0d51b9f0e1b4050595ec4e052c4b61ab89da1ba
|
4
|
+
data.tar.gz: a4091a00af110da068186784c650a5a6dedf1f711f7a619ec188b76a6b53dd85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfdc5d97e55f0d322a7b5a6df6e520eae8c33887f3c49e67244d7180180d99c1b0b7d7a138b0813817d3fb882f9cefb36eac46cf1b6305f2d7d6788ae4e330ac
|
7
|
+
data.tar.gz: 020607c3cba7ed60abc415d4cbd423cb6a9db6314ff2414389512d00bc9a8960caa61cb3770598c013af7cb6041b972afdb64c5c6a2852900bca7ed8420d22de
|
data/lib/aranha/rails/process.rb
CHANGED
@@ -6,17 +6,28 @@ module Aranha
|
|
6
6
|
QUEUE = 'aranha'
|
7
7
|
QUEUES = [QUEUE].freeze
|
8
8
|
|
9
|
+
enable_listable
|
10
|
+
lists.add_symbol :option, :limit
|
11
|
+
|
12
|
+
common_constructor :options, default: [{}] do
|
13
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
14
|
+
end
|
15
|
+
|
9
16
|
def run
|
10
17
|
run_init
|
11
18
|
run_jobs_workoff
|
12
19
|
run_close
|
13
20
|
end
|
14
21
|
|
22
|
+
def limit
|
23
|
+
options[OPTION_LIMIT].if_present(-1, &:to_i)
|
24
|
+
end
|
25
|
+
|
15
26
|
private
|
16
27
|
|
17
28
|
def run_close
|
18
|
-
::Aranha::Address.failed do |a|
|
19
|
-
::Rails.logger.
|
29
|
+
::Aranha::Address.failed.each do |a|
|
30
|
+
::Rails.logger.warn "Failed \"#{a.url}\": #{a.last_error}"
|
20
31
|
end
|
21
32
|
raise 'Some address failed' if ::Aranha::Address.failed.any?
|
22
33
|
end
|
@@ -27,7 +38,8 @@ module Aranha
|
|
27
38
|
end
|
28
39
|
|
29
40
|
def run_jobs_workoff
|
30
|
-
::Delayed::Worker.new(exit_on_complete: true, queues: QUEUES)
|
41
|
+
worker = ::Delayed::Worker.new(exit_on_complete: true, queues: QUEUES)
|
42
|
+
limit.negative? ? worker.start : worker.work_off(limit)
|
31
43
|
end
|
32
44
|
end
|
33
45
|
end
|
data/lib/aranha/rails/version.rb
CHANGED
data/lib/tasks/aranha.rake
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
namespace(:aranha) do
|
4
4
|
desc 'Process Aranha\'s addresses.'
|
5
|
-
task process
|
6
|
-
::Aranha::Rails::Process.new.run
|
5
|
+
task :process, %i[limit] => :environment do |_t, args|
|
6
|
+
::Aranha::Rails::Process.new(limit: args.limit).run
|
7
7
|
end
|
8
8
|
|
9
9
|
desc 'Remove all registered Aranha\'s addresses.'
|
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.
|
4
|
+
version: 0.8.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: 2021-
|
11
|
+
date: 2021-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha
|
@@ -126,20 +126,14 @@ dependencies:
|
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '0.
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 0.3.1
|
129
|
+
version: '0.4'
|
133
130
|
type: :development
|
134
131
|
prerelease: false
|
135
132
|
version_requirements: !ruby/object:Gem::Requirement
|
136
133
|
requirements:
|
137
134
|
- - "~>"
|
138
135
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0.
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: 0.3.1
|
136
|
+
version: '0.4'
|
143
137
|
description:
|
144
138
|
email:
|
145
139
|
executables: []
|