async-job-adapter-active_job 0.15.0 → 0.16.1

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: 754e798963465a3af74167d1fed826c57f37dd843bb5e0150ab4109e940c3658
4
- data.tar.gz: e8d8dd967ce0f5f444f1fffa3091a7081c87678b33c8607e8ffb111057d7b51f
3
+ metadata.gz: 746074fe68706d72a16283af03c689c54e154052ab9f31a26ddce25b6a832152
4
+ data.tar.gz: '08cb683f3bdcab3d0b57a6a4934620cbbb73fefd4b3588f8c2fbe3369277a971'
5
5
  SHA512:
6
- metadata.gz: 335a1ede4d6f09e76f11ec86abb87481e5e64ab7fd100fd2614ee7e828a5a5bce1687aab08d919c559769181346e7b7f0fa230866a6a7a1f2bb073c97004953e
7
- data.tar.gz: dc681b9ed7b5ec17af74784b3404d92e6f60d5d9a9d0afb5c0a87c8eb0b9be08ae40f5561009989fcad6e862715a568a65eae3828d4092510552cee4e8fed519
6
+ metadata.gz: 917fec234aeb5ea37501cbe497b75620fa67e83ba43bbc6b0c5dd79f9d1ad1b9f804dc6f6fcbe13775b804f83be48610b9283e1c90b8db1b7fda78fa8478bcf7
7
+ data.tar.gz: de17e27693aa2eef6ab0d40aa71ae6953ee626b883c132a3609b313c149791fb64053a023e445a68619e60f4cde154c74cd886fce91c78a4fa60c34c37ce4ade
checksums.yaml.gz.sig CHANGED
Binary file
@@ -61,6 +61,16 @@ module Async
61
61
  @definitions.keys
62
62
  end
63
63
 
64
+ def status_string
65
+ @queues.map do |name, queue|
66
+ if queue.respond_to?(:status_string)
67
+ "#{name} (#{queue.status_string})"
68
+ else
69
+ name
70
+ end
71
+ end.join(", ")
72
+ end
73
+
64
74
  private def build(definition)
65
75
  builder = Builder.new(Executor::DEFAULT)
66
76
 
@@ -36,6 +36,15 @@ module Async
36
36
  dispatcher.keys
37
37
  end
38
38
  end
39
+
40
+ # Options to use when creating the container.
41
+ def container_options
42
+ {
43
+ restart: true,
44
+ count: self.count,
45
+ health_check_timeout: 30,
46
+ }.compact
47
+ end
39
48
  end
40
49
  end
41
50
  end
@@ -33,7 +33,7 @@ module Async
33
33
  # The aliases for the definitions, if any.
34
34
  attr :aliases
35
35
 
36
- # Thed default dispatcher for processing jobs.
36
+ # The default dispatcher for processing jobs.
37
37
  attr :dispatcher
38
38
 
39
39
  # Define a new backend for processing jobs.
@@ -17,6 +17,9 @@ module Async
17
17
  class Service < Async::Service::Generic
18
18
  # Load the Rails environment and start the job server.
19
19
  def setup(container)
20
+ container_options = @evaluator.container_options
21
+ health_check_timeout = container_options[:health_check_timeout]
22
+
20
23
  container.run(name: self.name, restart: true) do |instance|
21
24
  evaluator = @environment.evaluator
22
25
 
@@ -26,6 +29,16 @@ module Async
26
29
 
27
30
  instance.ready!
28
31
 
32
+ if health_check_timeout
33
+ Async(transient: true) do
34
+ while true
35
+ instance.name = "#{self.name} (#{dispatcher.status_string})"
36
+ sleep(health_check_timeout / 2)
37
+ instance.ready!
38
+ end
39
+ end
40
+ end
41
+
29
42
  Sync do |task|
30
43
  barrier = Async::Barrier.new
31
44
 
@@ -56,6 +56,11 @@ module Async
56
56
  def keys
57
57
  @definitions.keys
58
58
  end
59
+
60
+ # Get the status string for the dispatcher, useful for process titles.
61
+ def status_string
62
+ dispatcher.status_string
63
+ end
59
64
  end
60
65
  end
61
66
  end
@@ -7,7 +7,7 @@ module Async
7
7
  module Job
8
8
  module Adapter
9
9
  module ActiveJob
10
- VERSION = "0.15.0"
10
+ VERSION = "0.16.1"
11
11
  end
12
12
  end
13
13
  end
data/readme.md CHANGED
@@ -14,6 +14,15 @@ Please see the [project documentation](https://socketry.github.io/async-job-adap
14
14
 
15
15
  Please see the [project releases](https://socketry.github.io/async-job-adapter-active_job/releases/index) for all releases.
16
16
 
17
+ ### v0.16.1
18
+
19
+ - Fixed `ThreadLocalDispatcher` to correctly handle `status_string`.
20
+
21
+ ### v0.16.0
22
+
23
+ - Add container options for controlling number of workers and health check timeout.
24
+ - Add `status_string` method to `Dispatcher` for better process titles.
25
+
17
26
  ### v0.15.0
18
27
 
19
28
  - Fix handling of scheduled jobs with proper `scheduled_at` assignment.
@@ -55,15 +64,6 @@ Please see the [project releases](https://socketry.github.io/async-job-adapter-a
55
64
 
56
65
  - Rename "pipeline" concept to "queue" for consistency.
57
66
 
58
- ### v0.9.0
59
-
60
- - Update interface to suit upstream async-job changes.
61
-
62
- ### v0.8.0
63
-
64
- - Add `#start`/`#stop` delegators for better lifecycle management.
65
- - Performance improvements with benchmarking.
66
-
67
67
  ## Contributing
68
68
 
69
69
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Releases
2
2
 
3
+ ## v0.16.1
4
+
5
+ - Fixed `ThreadLocalDispatcher` to correctly handle `status_string`.
6
+
7
+ ## v0.16.0
8
+
9
+ - Add container options for controlling number of workers and health check timeout.
10
+ - Add `status_string` method to `Dispatcher` for better process titles.
11
+
3
12
  ## v0.15.0
4
13
 
5
14
  - Fix handling of scheduled jobs with proper `scheduled_at` assignment.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-job-adapter-active_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- kbhy5k�����9PpD��K�������P��`.
2
- ƅv���oAi��k{�쵇�?��!z5(]��+�j"�E�%+��=2U��n�������s ���c�y�w J|;����YITL8��H�e�>�����l>b����w?K�96�U��Ek�Ha�L�D���@WI���u2'j:vw��K��p���U�����#�/���o֋Mp�8T�C�r��0��|i���_��3eo�N����Ť�T֞b�2��a�� ")���5qRnP��ѳaڊ�5��jeB���<V���s�z@*�I ��ڲ#U:d���N���QcD�a/E��e'�,L�.�U�Î��,4�C(@AY�i��.��ߴw]��X
1
+ "�v�����Xt'�J9i���8(��'���֒����n���rq{����N����)b�#@�y�+N��cbc���N�Rz��}�k
2
+ _�*F�[|�Bx7q2a�RA���<���WM;�k�8L����W���^�oE��-M.�t̮�C"���JY�˖�<A)'uFv<WBec��o*:pZ���O��#��|O��LdU��Y� �2k!��{����.3 O6�^I5.�#ڇl݄�j{��� MI��S���F�֯�q��x}��!���;���`�HKM����<�bwH_YXc��B]����9fjQ&p�a