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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d239706dd3ab35e45e5323cf31a72ef271a54549af7e4e7048a9409d14c7e15
4
- data.tar.gz: e1512c3a6f2907d5b0cb2e0d68c2667395abb52ef3001513ba8739c7ce2ec71d
3
+ metadata.gz: 7549d708d366c904799577c0b0d51b9f0e1b4050595ec4e052c4b61ab89da1ba
4
+ data.tar.gz: a4091a00af110da068186784c650a5a6dedf1f711f7a619ec188b76a6b53dd85
5
5
  SHA512:
6
- metadata.gz: 82d8caf5476cb0ec35adbbbb331d60a4485e928fc09670c4aa37ae8d5e901cd7ee03000f3f0c31905fff1b326fa26e18e4f24228ea02a5ae710024b1bc437487
7
- data.tar.gz: 2b74eecd11c26522fe44dd7c15bcf8d204e78e7bc1457c97b04ad626fe002b4955c7599e29c22af1af76510aff04f10fb472d5cd78f1ebf9963e2be49e0dd8af
6
+ metadata.gz: dfdc5d97e55f0d322a7b5a6df6e520eae8c33887f3c49e67244d7180180d99c1b0b7d7a138b0813817d3fb882f9cefb36eac46cf1b6305f2d7d6788ae4e330ac
7
+ data.tar.gz: 020607c3cba7ed60abc415d4cbd423cb6a9db6314ff2414389512d00bc9a8960caa61cb3770598c013af7cb6041b972afdb64c5c6a2852900bca7ed8420d22de
@@ -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).start
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Rails
5
- VERSION = '0.7.5'
5
+ VERSION = '0.8.0'
6
6
  end
7
7
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  namespace(:aranha) do
4
4
  desc 'Process Aranha\'s addresses.'
5
- task process: :environment do
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.7.5
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-10-27 00:00:00.000000000 Z
11
+ date: 2021-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha