aranha-rails 0.7.5 → 0.8.0
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/aranha/rails/process.rb +13 -1
- data/lib/aranha/rails/version.rb +1 -1
- data/lib/tasks/aranha.rake +2 -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: 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,12 +6,23 @@ 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
|
|
@@ -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
|