aws-activejob-sqs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d637830be5b747a64bf196605511e325d998d43bdd378ce9377a04c4cd0d217
4
- data.tar.gz: 3dd1d9a0385451965ef4e4efc9f51c73a9bdc5e896d4a2a9cd65c862319aac8b
3
+ metadata.gz: 1eeedcef79ed4252667f821bcd84cef11304edc53368206191e415a75c6d9f6e
4
+ data.tar.gz: 7478443ea1a47d862e217a9f5ce44b81cd8c96bfc9a6360b5c48b6681c71f39f
5
5
  SHA512:
6
- metadata.gz: edeeb1caccc5479f6a70bffada55cce0d7a15e70088a3a9f381782be366cf8200e0a16b03291be78c551a54b18192268b32b85f8626b6f0a23cf1b2392cd7da7
7
- data.tar.gz: 945cce4e13a9ccf35d5f2521da551dc53dc349bdb1667a20ad7ad7c8d509b97d7892761a418152afafad3656ebdecdfc2d8bee0f1922be54a72d40ea4703218f
6
+ metadata.gz: f61a2e9c1d5065feadde7833499909449cc1ce390569e5528fca0633315364b24dc27d87cee3a9b39d98b6081a7405e2537584a8713119df68db6b3b87d03e1f
7
+ data.tar.gz: a75662933ed22c33465d209fe95034a1c874b38fdcc50e595417d04f025b870a0e7054fdf007bd53e19c461519a193e6996c830e1d1654d7a34a8224f75a9530
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.1.1 (2024-12-02)
2
+ ------------------
3
+
4
+ * Feature - Add lifecycle hooks for Executor.
5
+
1
6
  0.1.0 (2024-11-16)
2
7
  ------------------
3
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -15,6 +15,20 @@ module Aws
15
15
  fallback_policy: :abort # Concurrent::RejectedExecutionError must be handled
16
16
  }.freeze
17
17
 
18
+ class << self
19
+ def on_stop(&block)
20
+ lifecycle_hooks[:stop] << block
21
+ end
22
+
23
+ def lifecycle_hooks
24
+ @lifecycle_hooks ||= Hash.new { |h, k| h[k] = [] }
25
+ end
26
+
27
+ def clear_hooks
28
+ @lifecycle_hooks = nil
29
+ end
30
+ end
31
+
18
32
  def initialize(options = {})
19
33
  @executor = Concurrent::ThreadPoolExecutor.new(DEFAULTS.merge(options))
20
34
  @retry_standard_errors = options[:retry_standard_errors]
@@ -32,6 +46,7 @@ module Aws
32
46
  end
33
47
 
34
48
  def shutdown(timeout = nil)
49
+ run_hooks_for(:stop)
35
50
  @executor.shutdown
36
51
  clean_shutdown = @executor.wait_for_termination(timeout)
37
52
  if clean_shutdown
@@ -71,6 +86,12 @@ module Aws
71
86
  @task_complete.set
72
87
  end
73
88
  end
89
+
90
+ def run_hooks_for(event_name)
91
+ return unless (hooks = self.class.lifecycle_hooks[event_name])
92
+
93
+ hooks.each(&:call)
94
+ end
74
95
  end
75
96
  end
76
97
  end
@@ -29,6 +29,10 @@ module Aws
29
29
  def self.fifo?(queue_url)
30
30
  queue_url.end_with?('.fifo')
31
31
  end
32
+
33
+ def self.on_worker_stop(...)
34
+ Executor.on_stop(...)
35
+ end
32
36
  end
33
37
  end
34
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-activejob-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-16 00:00:00.000000000 Z
11
+ date: 2024-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.5.11
102
+ rubygems_version: 3.5.9
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: ActiveJob integration with SQS