async-job-adapter-active_job 0.15.0 → 0.16.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: 754e798963465a3af74167d1fed826c57f37dd843bb5e0150ab4109e940c3658
4
- data.tar.gz: e8d8dd967ce0f5f444f1fffa3091a7081c87678b33c8607e8ffb111057d7b51f
3
+ metadata.gz: f9028d5ddf718de2229cf9ee46890e5a457b13a6d8dbaa25f2c900f6a54d50e3
4
+ data.tar.gz: 9cb4bbfc5097aa6a9df7380e07355dc718dd1861c34471ae97dc90267801cf1f
5
5
  SHA512:
6
- metadata.gz: 335a1ede4d6f09e76f11ec86abb87481e5e64ab7fd100fd2614ee7e828a5a5bce1687aab08d919c559769181346e7b7f0fa230866a6a7a1f2bb073c97004953e
7
- data.tar.gz: dc681b9ed7b5ec17af74784b3404d92e6f60d5d9a9d0afb5c0a87c8eb0b9be08ae40f5561009989fcad6e862715a568a65eae3828d4092510552cee4e8fed519
6
+ metadata.gz: a1b1a5ffb596faa0b7e0d503375d8df9831d83b992f0dd0c0b1d2b79e6dcba2268be29d365c2ae665656abdadb1b33af5c160a045f94850f96e7af07224c9057
7
+ data.tar.gz: 7acc485f3da39145c55d6aa15f49392ad24dddace96c2218d4fe96b6dacbe25827c0a9e67bd67c2294fdfe387c832809988e58eaad9ce8415c8effdf803c239a
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
 
@@ -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.0"
11
11
  end
12
12
  end
13
13
  end
data/readme.md CHANGED
@@ -14,6 +14,11 @@ 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.0
18
+
19
+ - Add container options for controlling number of workers and health check timeout.
20
+ - Add `status_string` method to `Dispatcher` for better process titles.
21
+
17
22
  ### v0.15.0
18
23
 
19
24
  - Fix handling of scheduled jobs with proper `scheduled_at` assignment.
@@ -59,11 +64,6 @@ Please see the [project releases](https://socketry.github.io/async-job-adapter-a
59
64
 
60
65
  - Update interface to suit upstream async-job changes.
61
66
 
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,10 @@
1
1
  # Releases
2
2
 
3
+ ## v0.16.0
4
+
5
+ - Add container options for controlling number of workers and health check timeout.
6
+ - Add `status_string` method to `Dispatcher` for better process titles.
7
+
3
8
  ## v0.15.0
4
9
 
5
10
  - 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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
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���Qc�D�a/E��e'�,L�.�U�Î��,4�C(@AY�i��.��ߴw]��X
1
+ K���g�!,4î�CY/ J*� e��'�*b%燫kzD�/�Ι����t�ư�c��:�-��;�Z}~�
2
+ �j"��ѱ��3���߽��_Vu��ߘyH����c"��l5T
3
+ ���Ĺ�U�P{b@;��P_�Q���h(���E�X�6oDO����y~��u�����H%�!�� �V���w�~���Iϸ^v��M��O�YS�޸^_��<�c'8��,0<�����_rǭ`P�W�:c�1=��Xk�;X� B�\WyIA��L���� i�NJ��G9�𡜇À`�K6�:0�*������S�n_�n4��Q��Y]��Z�] q6�