async-job 0.10.1 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/job/processor/inline.rb +26 -0
- data/lib/async/job/version.rb +2 -2
- data/license.md +2 -0
- data/readme.md +9 -14
- data/releases.md +9 -1
- data.tar.gz.sig +0 -0
- metadata +18 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f85e329bfcf07e41d2e4f560e98fe4f23d12890291e0b474d2277e686f1326
|
4
|
+
data.tar.gz: f9113aef05940a7e575f0b340949779e22137e386ea4e4e102e95099103eade0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -23,8 +24,21 @@ module Async
|
|
23
24
|
super(delegate)
|
24
25
|
|
25
26
|
@parent = parent || Async::Idler.new
|
27
|
+
|
28
|
+
@call_count = 0
|
29
|
+
@complete_count = 0
|
30
|
+
@failed_count = 0
|
26
31
|
end
|
27
32
|
|
33
|
+
# @attribute [Integer] The current number of in-progress jobs.
|
34
|
+
attr_reader :call_count
|
35
|
+
|
36
|
+
# @attribute [Integer] The count of completed jobs.
|
37
|
+
attr_reader :complete_count
|
38
|
+
|
39
|
+
# @attribute [Integer] The count of failed jobs.
|
40
|
+
attr_reader :failed_count
|
41
|
+
|
28
42
|
# Process a job asynchronously with optional scheduling.
|
29
43
|
# If the job has a scheduled_at time, the processor will wait until that time before execution.
|
30
44
|
# @parameter job [Hash] The job data containing execution details.
|
@@ -36,9 +50,14 @@ module Async
|
|
36
50
|
sleep(scheduled_at - Time.now)
|
37
51
|
end
|
38
52
|
|
53
|
+
@call_count += 1
|
39
54
|
@delegate.call(job)
|
55
|
+
@complete_count += 1
|
40
56
|
rescue => error
|
57
|
+
@failed_count += 1
|
41
58
|
Console.error(self, error)
|
59
|
+
ensure
|
60
|
+
@call_count -= 1
|
42
61
|
end
|
43
62
|
end
|
44
63
|
|
@@ -51,6 +70,13 @@ module Async
|
|
51
70
|
def stop
|
52
71
|
@delegate.stop
|
53
72
|
end
|
73
|
+
|
74
|
+
# Returns statistics about the processor's job counts.
|
75
|
+
#
|
76
|
+
# - `c`: call count / completed count.
|
77
|
+
def status_string
|
78
|
+
"C=#{String::Format.count(@call_count)}/#{String::Format.count(@complete_count)} F=#{String::Format.count(@failed_count)}"
|
79
|
+
end
|
54
80
|
end
|
55
81
|
end
|
56
82
|
end
|
data/lib/async/job/version.rb
CHANGED
data/license.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
Copyright, 2024-2025, by Samuel Williams.
|
4
4
|
Copyright, 2024, by Alexey Ivanov.
|
5
5
|
Copyright, 2025, by Shopify Inc.
|
6
|
+
Copyright, 2025, by Garen Torikian.
|
7
|
+
Copyright, 2025, by Luiz Carlos.
|
6
8
|
|
7
9
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
10
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -18,6 +18,15 @@ 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
|
+
|
26
|
+
### v0.10.2
|
27
|
+
|
28
|
+
- Minor code cleanup.
|
29
|
+
|
21
30
|
### v0.10.1
|
22
31
|
|
23
32
|
- Add release notes and modernize code.
|
@@ -25,7 +34,6 @@ Please see the [project releases](https://socketry.github.io/async-job/releases/
|
|
25
34
|
- Improve test formatting and modernize code.
|
26
35
|
- Achieve 100% test coverage.
|
27
36
|
- Achieve 100% documentation coverage.
|
28
|
-
- Add agent context.
|
29
37
|
|
30
38
|
### v0.10.0
|
31
39
|
|
@@ -65,19 +73,6 @@ Please see the [project releases](https://socketry.github.io/async-job/releases/
|
|
65
73
|
- Add documentation regarding aggregate backend.
|
66
74
|
- Prefer `before do` ... in tests.
|
67
75
|
|
68
|
-
### v0.6.0
|
69
|
-
|
70
|
-
- Add support for delegate pass-through.
|
71
|
-
- Modernize gem.
|
72
|
-
- Add client and server example (\#3).
|
73
|
-
- Fix gem name in guide.
|
74
|
-
|
75
|
-
### v0.5.0
|
76
|
-
|
77
|
-
- Add benchmark example.
|
78
|
-
- Add support for `Async::Idler`.
|
79
|
-
- Add link to `async-job-adapter-active_job`.
|
80
|
-
|
81
76
|
## See Also
|
82
77
|
|
83
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,14 @@
|
|
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
|
+
|
8
|
+
## v0.10.2
|
9
|
+
|
10
|
+
- Minor code cleanup.
|
11
|
+
|
3
12
|
## v0.10.1
|
4
13
|
|
5
14
|
- Add release notes and modernize code.
|
@@ -7,7 +16,6 @@
|
|
7
16
|
- Improve test formatting and modernize code.
|
8
17
|
- Achieve 100% test coverage.
|
9
18
|
- Achieve 100% documentation coverage.
|
10
|
-
- Add agent context.
|
11
19
|
|
12
20
|
## v0.10.0
|
13
21
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
- Shopify Inc.
|
9
9
|
- Alexey Ivanov
|
10
|
+
- Garen Torikian
|
11
|
+
- Luiz Carlos
|
10
12
|
bindir: bin
|
11
13
|
cert_chain:
|
12
14
|
- |
|
@@ -54,6 +56,20 @@ dependencies:
|
|
54
56
|
- - "~>"
|
55
57
|
- !ruby/object:Gem::Version
|
56
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'
|
57
73
|
executables: []
|
58
74
|
extensions: []
|
59
75
|
extra_rdoc_files: []
|
@@ -94,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
110
|
- !ruby/object:Gem::Version
|
95
111
|
version: '0'
|
96
112
|
requirements: []
|
97
|
-
rubygems_version: 3.6.
|
113
|
+
rubygems_version: 3.6.9
|
98
114
|
specification_version: 4
|
99
115
|
summary: An asynchronous job queue for Ruby.
|
100
116
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|