async-job 0.10.2 → 0.11.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: c4d685ecfe4b2bcf0a11c11303182e18d65ca7f775494d6fe7dfbd4a89618afc
4
- data.tar.gz: 813aafc522f61f5cc4554052b022b443e05f917ae0bad490eb1aa492eeaf2293
3
+ metadata.gz: b2f85e329bfcf07e41d2e4f560e98fe4f23d12890291e0b474d2277e686f1326
4
+ data.tar.gz: f9113aef05940a7e575f0b340949779e22137e386ea4e4e102e95099103eade0
5
5
  SHA512:
6
- metadata.gz: '08d1e3788e6b630c82b6d6597ec0601fd44794e2c956e2dee5cefc99f64e6485723e01aa4037ba322217e186d4db7773a078e724604f92b30b954b906e2a79cf'
7
- data.tar.gz: '06279270c160d0dee2442a217af525c170f18e748203532ecf1ab43a29dfec3a0f62aea8c82b274d4d6b726be88ed799f4babad40bbceff44298759d40342a3f'
6
+ metadata.gz: 567e1c3ba3cd2713aba682f6f6d3cc69e136a6dc286f6e48949d11cf405fbb96352e5a0106c35b43985851defc12c83b8eaf54c4161d4e5b56cbaf685e7100e6
7
+ data.tar.gz: c48df37603abd9bb18b0b68eca416743331b90446e59ccecc885b145e3b3900173e3f65652fca639054a6f785c1f300b76497816a94e1b43fd8b333886ed2442
checksums.yaml.gz.sig CHANGED
Binary file
@@ -8,6 +8,7 @@ require_relative "../coder"
8
8
  require_relative "generic"
9
9
 
10
10
  require "async/idler"
11
+ require "string/format"
11
12
 
12
13
  module Async
13
14
  module Job
@@ -26,11 +27,18 @@ module Async
26
27
 
27
28
  @call_count = 0
28
29
  @complete_count = 0
30
+ @failed_count = 0
29
31
  end
30
32
 
33
+ # @attribute [Integer] The current number of in-progress jobs.
34
+ attr_reader :call_count
35
+
31
36
  # @attribute [Integer] The count of completed jobs.
32
37
  attr_reader :complete_count
33
38
 
39
+ # @attribute [Integer] The count of failed jobs.
40
+ attr_reader :failed_count
41
+
34
42
  # Process a job asynchronously with optional scheduling.
35
43
  # If the job has a scheduled_at time, the processor will wait until that time before execution.
36
44
  # @parameter job [Hash] The job data containing execution details.
@@ -46,7 +54,10 @@ module Async
46
54
  @delegate.call(job)
47
55
  @complete_count += 1
48
56
  rescue => error
57
+ @failed_count += 1
49
58
  Console.error(self, error)
59
+ ensure
60
+ @call_count -= 1
50
61
  end
51
62
  end
52
63
 
@@ -63,8 +74,8 @@ module Async
63
74
  # Returns statistics about the processor's job counts.
64
75
  #
65
76
  # - `c`: call count / completed count.
66
- def statistics
67
- {c: [@call_count, @complete_count]}
77
+ def status_string
78
+ "C=#{String::Format.count(@call_count)}/#{String::Format.count(@complete_count)} F=#{String::Format.count(@failed_count)}"
68
79
  end
69
80
  end
70
81
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Job
8
- VERSION = "0.10.2"
8
+ VERSION = "0.11.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -18,6 +18,11 @@ Please see the [project documentation](https://socketry.github.io/async-job/) fo
18
18
 
19
19
  Please see the [project releases](https://socketry.github.io/async-job/releases/index) for all releases.
20
20
 
21
+ ### v0.11.0
22
+
23
+ - Use `String::Format` for formatting strings and restore <code class="language-ruby">Async::Job::Processor::Inline\#status\_string</code>.
24
+ - Add failed count to inline processor.
25
+
21
26
  ### v0.10.2
22
27
 
23
28
  - Minor code cleanup.
@@ -68,13 +73,6 @@ Please see the [project releases](https://socketry.github.io/async-job/releases/
68
73
  - Add documentation regarding aggregate backend.
69
74
  - Prefer `before do` ... in tests.
70
75
 
71
- ### v0.6.0
72
-
73
- - Add support for delegate pass-through.
74
- - Modernize gem.
75
- - Add client and server example (\#3).
76
- - Fix gem name in guide.
77
-
78
76
  ## See Also
79
77
 
80
78
  - [async-job-processor-redis](https://github.com/socketry/async-job-processor-redis) - Redis processor for `async-job` (similar to Sidekiq).
data/releases.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Releases
2
2
 
3
+ ## v0.11.0
4
+
5
+ - Use `String::Format` for formatting strings and restore {ruby Async::Job::Processor::Inline\#status\_string}.
6
+ - Add failed count to inline processor.
7
+
3
8
  ## v0.10.2
4
9
 
5
10
  - Minor code cleanup.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -56,6 +56,20 @@ dependencies:
56
56
  - - "~>"
57
57
  - !ruby/object:Gem::Version
58
58
  version: '2.9'
59
+ - !ruby/object:Gem::Dependency
60
+ name: string-format
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
65
+ version: '0.2'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.2'
59
73
  executables: []
60
74
  extensions: []
61
75
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file