sqewer 8.1.0 → 10.0.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: 2e5fc06a5281d8f654c015e190e1c2a7ac67a2fda1ccb2d1b14efbb8ecc30452
4
- data.tar.gz: 570bb873fc72efb58bc93d8ccda578fc3ee0005105f2cc49e86383115e9657c5
3
+ metadata.gz: 4fd3e716de2cc1860f1c1638f8cfe0f21b965c82b0026c1315eb13c8668b5056
4
+ data.tar.gz: a727f9e4e226811b7553efe1daff8bda680ac03a61bc37f6c3c2020b410b7351
5
5
  SHA512:
6
- metadata.gz: 6efd7484bc5acf361314b09d0d5525fb9396b285df5fd5ee8e65e0d7dc53c0735f97273210f9adf9495f2a013e58f8a071c0d221303787499e6bf7b63ecc87cd
7
- data.tar.gz: 37b8754720c2e9b327ebc5f3df5ac320fc9291f0e6447dcb68881fec861c69ed2917154c0dda57e48e6f120dd9ee60dbccbcf43b183319928b70917e836bc990
6
+ metadata.gz: 036f10c4debed8416fe639adcfc3e7f38d1e9fc4825f01892e98d518997823b7c1291f6ad51190d3f79f49027d843862b3b92f79c0f4da73f1bebbea3078e6c8
7
+ data.tar.gz: 0cc332e0f3ab31d02254356b33c3b097cf0700f259f87ed63734a61d9df47817b119fa3f7f8ddd427ed624ea1ee72b7bd0a25105127273392cb906693c520f21
@@ -0,0 +1 @@
1
+ * @WeTransfer/WeTransfer-CodeOwners
@@ -0,0 +1,16 @@
1
+ ---
2
+ version: 2
3
+ updates:
4
+ - package-ecosystem: github-actions
5
+ directory: /
6
+ schedule:
7
+ interval: daily
8
+ time: "10:00"
9
+ timezone: Europe/Amsterdam
10
+ - package-ecosystem: bundler
11
+ directory: /
12
+ registries: "*"
13
+ schedule:
14
+ interval: daily
15
+ time: "09:00"
16
+ timezone: Europe/Amsterdam
@@ -9,26 +9,24 @@ jobs:
9
9
  strategy:
10
10
  matrix:
11
11
  ruby:
12
+ - 3.2
12
13
  - 3.1
13
14
  - 3.0
14
- - 2.7
15
- - 2.6
16
15
  gemfile:
17
- - gemfiles/Gemfile.rails-5.0.x
18
- - gemfiles/Gemfile.rails-5.1.x
19
- - gemfiles/Gemfile.rails-6.0.x
16
+ - gemfiles/Gemfile.rails-6.1.x
17
+ - gemfiles/Gemfile.rails-7.0.x
20
18
  env:
21
19
  SQS_QUEUE_URL: 'sqlite3://tmp/sqewer.sqlite3'
22
20
  AWS_REGION: 'eu-central-1'
23
21
  steps:
24
- - uses: actions/checkout@v2
22
+ - uses: actions/checkout@v4
25
23
  - name: Set up Ruby
26
24
  uses: ruby/setup-ruby@v1
27
25
  with:
28
26
  ruby-version: ${{ matrix.ruby }}
29
27
  - name: install gems
30
28
  run: |
31
- gem install sqlite3
29
+ gem install sqlite3 -v '~> 1.0'
32
30
  gem install bundler
33
31
  bundle install --gemfile ${{ matrix.gemfile }}
34
32
  - name: Tests
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 10.0.0
2
+ - Ensure all worker threads exit if a thread dies in case of an unhandled exception, to avoid "zombie" workers (running without any consumer thread)
3
+
4
+ ### 9.0.0
5
+ - Add support for Ruby 3.2 and Rails 7
6
+ - Remove support for Ruby 2.6, 2.7 and Rails 5 and 6.0
7
+
1
8
  ### 8.1.0
2
9
  - dropped dependency on `ks` gem
3
10
  - added rails6 and ruby3/3.1 to test matrix
data/README.md CHANGED
@@ -48,7 +48,7 @@ The messages will only be deleted from SQS once the job execution completes with
48
48
 
49
49
  ## Requirements
50
50
 
51
- Ruby 2.6+, version 2 of the AWS SDK. You can also run Sqewer backed by a SQLite database file, which can be handy for development situations.
51
+ Ruby 3+, version 2 of the AWS SDK. You can also run Sqewer backed by a SQLite database file, which can be handy for development situations.
52
52
 
53
53
  ## Job storage
54
54
 
@@ -415,4 +415,3 @@ the Ruby standard library alone.
415
415
  ## Copyright
416
416
 
417
417
  Copyright (c) 2016 WeTransfer. See LICENSE.txt for further details.
418
-
@@ -4,5 +4,5 @@ source "http://rubygems.org"
4
4
  gemspec path: __dir__ + '/..'
5
5
 
6
6
  gem 'sqlite3', "~> 1.3", ">= 1.3.6"
7
- gem 'activejob', "~> 5.1.0"
8
- gem 'activerecord', "~> 5.1.0"
7
+ gem 'activejob', "~> 6.1.0"
8
+ gem 'activerecord', "~> 6.1.0"
@@ -4,5 +4,5 @@ source "http://rubygems.org"
4
4
  gemspec path: __dir__ + '/..'
5
5
 
6
6
  gem 'sqlite3', "~> 1.3", ">= 1.3.6"
7
- gem 'activejob', "~> 6.0.0"
8
- gem 'activerecord', "~> 6.0.0"
7
+ gem 'activejob', "~> 7.0.0"
8
+ gem 'activerecord', "~> 7.0.0"
@@ -1,14 +1,6 @@
1
1
  # ActiveJob docs: http://edgeguides.rubyonrails.org/active_job_basics.html
2
2
  # Example adapters ref: https://github.com/rails/rails/tree/master/activejob/lib/active_job/queue_adapters
3
3
  module ActiveJob
4
- # Only prepend the module with keyword argument acceptance when the version is 4
5
- # ActiveJob 5.x supports kwargs out of the box
6
- if ActiveJob::VERSION::MAJOR <= 4
7
- module Execution
8
- prepend PerformWithKeywords
9
- end
10
- end
11
-
12
4
  module QueueAdapters
13
5
  # Handle Rails ActiveJob through sqewer.
14
6
  # Set it up like so:
@@ -56,48 +48,32 @@ module ActiveJob
56
48
  Base.execute(job)
57
49
  end
58
50
  end
59
-
51
+
60
52
  private
61
-
53
+
62
54
  def with_active_record_connection_from_pool
63
55
  ActiveRecord::Base.connection_pool.with_connection { yield }
64
56
  end
65
-
57
+
66
58
  def active_record_defined_and_connected?
67
59
  defined?(ActiveRecord) && ActiveRecord::Base.connected?
68
60
  end
69
-
61
+
70
62
  end
71
63
 
72
- def self.enqueue(active_job) #:nodoc:
64
+ def enqueue(*args)
73
65
  wrapped_job = Performable.from_active_job(active_job)
74
66
 
75
67
  Sqewer.submit!(wrapped_job)
76
68
  end
77
69
 
78
- def self.enqueue_at(active_job, timestamp) #:nodoc:
70
+ def enqueue_at(*args)
79
71
  wrapped_job = Performable.from_active_job(active_job)
80
72
 
81
73
  delta_t = (timestamp - Time.now.to_i).to_i
82
74
 
83
75
  Sqewer.submit!(wrapped_job, delay_seconds: delta_t)
84
76
  end
85
-
86
- # ActiveJob in Rails 4 resolves the symbol value you give it
87
- # and then tries to call enqueue_* methods directly on what
88
- # got resolved. In Rails 5, first Rails will call .new on
89
- # what it resolved from the symbol and _then_ call enqueue
90
- # and enqueue_at on that what has gotten resolved. This means
91
- # that we have to expose these methods _both_ as class methods
92
- # and as instance methods.
93
- # This can be removed when we stop supporting Rails 4.
94
- def enqueue_at(*args)
95
- self.class.enqueue_at(*args)
96
- end
97
-
98
- def enqueue(*args)
99
- self.class.enqueue(*args)
100
- end
101
77
  end
102
78
  end
103
79
  end
@@ -1,3 +1,3 @@
1
1
  module Sqewer
2
- VERSION = '8.1.0'
2
+ VERSION = '10.0.0'
3
3
  end
data/lib/sqewer/worker.rb CHANGED
@@ -89,8 +89,14 @@ class Sqewer::Worker
89
89
  @logger.info { '[worker] Starting with %d consumer threads' % @num_threads }
90
90
  @execution_queue = Queue.new
91
91
 
92
- consumers = (1..@num_threads).map do
92
+ # Ensure that unhandled exceptions inside threads make the worker fail,
93
+ # to avoid silent failures with no consumer threads running.
94
+ Thread.abort_on_exception = true
95
+
96
+ consumers = (1..@num_threads).each_with_index.map do |_, index|
93
97
  Thread.new do
98
+ Thread.current[:role] = :consumer
99
+ Thread.current[:id] = index
94
100
  loop { take_and_execute }
95
101
  end
96
102
  end
@@ -99,6 +105,7 @@ class Sqewer::Worker
99
105
  # grab new messages and place them on the local queue.
100
106
  owning_worker = self # self won't be self anymore in the thread
101
107
  provider = Thread.new do
108
+ Thread.current[:role] = :provider
102
109
  loop do
103
110
  begin
104
111
  break if stopping?
data/sqewer.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{Process jobs from SQS}
13
13
  spec.description = %q{A full-featured library for all them SQS worker needs}
14
14
  spec.homepage = "https://github.com/WeTransfer/sqewer"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  - Andrei Horak
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-09 00:00:00.000000000 Z
12
+ date: 2024-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-sqs
@@ -246,9 +246,11 @@ executables:
246
246
  extensions: []
247
247
  extra_rdoc_files: []
248
248
  files:
249
+ - ".github/CODEOWNERS"
249
250
  - ".github/ISSUE_TEMPLATE/bug_report.md"
250
251
  - ".github/ISSUE_TEMPLATE/feature_request.md"
251
252
  - ".github/PULL_REQUEST_TEMPLATE.md"
253
+ - ".github/dependabot.yml"
252
254
  - ".github/workflows/main.yml"
253
255
  - ".gitignore"
254
256
  - ".yardopts"
@@ -260,9 +262,8 @@ files:
260
262
  - bin/sqewer
261
263
  - bin/sqewer_rails
262
264
  - example.env
263
- - gemfiles/Gemfile.rails-5.0.x
264
- - gemfiles/Gemfile.rails-5.1.x
265
- - gemfiles/Gemfile.rails-6.0.x
265
+ - gemfiles/Gemfile.rails-6.1.x
266
+ - gemfiles/Gemfile.rails-7.0.x
266
267
  - lib/sqewer.rb
267
268
  - lib/sqewer/atomic_counter.rb
268
269
  - lib/sqewer/cli.rb
@@ -288,7 +289,7 @@ homepage: https://github.com/WeTransfer/sqewer
288
289
  licenses: []
289
290
  metadata:
290
291
  allowed_push_host: https://rubygems.org
291
- post_install_message:
292
+ post_install_message:
292
293
  rdoc_options: []
293
294
  require_paths:
294
295
  - lib
@@ -296,15 +297,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
296
297
  requirements:
297
298
  - - ">="
298
299
  - !ruby/object:Gem::Version
299
- version: 2.6.0
300
+ version: 3.0.0
300
301
  required_rubygems_version: !ruby/object:Gem::Requirement
301
302
  requirements:
302
303
  - - ">="
303
304
  - !ruby/object:Gem::Version
304
305
  version: '0'
305
306
  requirements: []
306
- rubygems_version: 3.0.3.1
307
- signing_key:
307
+ rubygems_version: 3.5.17
308
+ signing_key:
308
309
  specification_version: 4
309
310
  summary: Process jobs from SQS
310
311
  test_files: []
@@ -1,8 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Gemspec as base dependency set
4
- gemspec path: __dir__ + '/..'
5
-
6
- gem 'sqlite3', '~> 1.3.6'
7
- gem 'activejob', "~> 5.0.0"
8
- gem 'activerecord', "~> 5.0.0"