gouda 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: f36a7c7b361cb8008f34b4a178c6bf1eb2a358e95502d0550fc14fef78ef5ed7
4
- data.tar.gz: 6d2bc5778d6284f212189f4311e575393c5d9c1da13e4618f0b9a5d6ace9e954
3
+ metadata.gz: 69ee0eda4e10e8777d9cb1df596472103558ace52ba2fd018de2fcbc28a59ead
4
+ data.tar.gz: 7d2eb26cafd53af69e52f8a5de8adf8d08678d7618dbccc6d50c500e49780c92
5
5
  SHA512:
6
- metadata.gz: 71a324a3bae3ee17c2ed547915b1cc841442059c30f0c85138f1b220a7c9dc2b307e6d0363fba12069be0b893ce74e1cefe81f5d3fc1ceec427b56a7331be256
7
- data.tar.gz: 8e9d521dc92ccd14175611e21535ed9e5b71610e74c22fd4038e11a16c104b9fc73d93431e1e9aae38bb37e739d91447f3739ddd8099083e4d6e821db1426ea5
6
+ metadata.gz: 7bb748afdacae3fe76ee49a4b82e45c282d3feeee6fb69cb390b57e9b05db9108d692521454121724fbec81970c297117befd900dde9a687bfc51d8b08a4cd8e
7
+ data.tar.gz: f14f7bad25ba4d0b2c22ec0dad98747ef1a1e79fa3a5978b987f13fbe340220eddfe6958fa1751083402c7f65a6e3f4129fdbb53bfa0d6e87ecc45692b7d4548
@@ -9,28 +9,37 @@ env:
9
9
  jobs:
10
10
  test:
11
11
  name: Tests
12
- runs-on: ubuntu-latest
12
+ runs-on: ubuntu-22.04
13
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - '2.7'
18
+ - '3.0'
19
+ - '3.1'
20
+ - '3.2'
21
+ - '3.3'
13
22
  services:
14
23
  postgres:
15
- image: postgres:15-alpine
24
+ image: postgres
16
25
  env:
17
26
  POSTGRES_PASSWORD: postgres
27
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
18
28
  ports:
19
29
  - 5432:5432
20
- options: >-
21
- --health-cmd pg_isready
22
- --health-interval 100ms
23
- --health-timeout 1s
24
- --health-retries 100
25
30
 
26
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
27
31
  steps:
28
32
  - name: Checkout
29
33
  uses: actions/checkout@v4
30
34
  - name: Setup Ruby
31
35
  uses: ruby/setup-ruby@v1
32
36
  with:
33
- ruby-version: '3.2'
37
+ ruby-version: ${{ matrix.ruby }}
34
38
  bundler-cache: true
35
39
  - name: "Tests and Lint"
36
40
  run: bundle exec rake
41
+ env:
42
+ PGHOST: localhost
43
+ PGUSER: postgres
44
+ PGPASSWORD: postgres
45
+ TESTOPTS: "--fail-fast"
data/.gitignore CHANGED
@@ -5,5 +5,6 @@
5
5
  /doc/
6
6
  /pkg/
7
7
  /spec/reports/
8
- /tmp/
8
+ /tmp/*
9
+ !/tmp/.keep
9
10
  Gemfile.lock
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.3.1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2023-05-27
3
+ ## [0.1.0] - 2023-06-10
4
4
 
5
5
  - Initial release
6
6
 
7
+ ## [0.1.1] - 2023-06-10
8
+
9
+ - Fix support for older ruby versions until 2.7
data/gouda.gemspec CHANGED
@@ -4,12 +4,12 @@ Gem::Specification.new do |spec|
4
4
  spec.name = "gouda"
5
5
  spec.version = Gouda::VERSION
6
6
  spec.summary = "Job Scheduler"
7
- spec.description = "Job Scheduler for Rails"
7
+ spec.description = "Job Scheduler for Rails and PostgreSQL"
8
8
  spec.authors = ["Sebastian van Hesteren", "Julik Tarkhanov"]
9
9
  spec.email = ["sebastian@cheddar.me", "me@julik.nl"]
10
10
  spec.homepage = "https://rubygems.org/gems/gouda"
11
11
  spec.license = "MIT"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
13
13
  spec.require_paths = ["lib"]
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
@@ -21,7 +21,7 @@ module Gouda
21
21
  enqueue_limit = total_limit
22
22
  end
23
23
 
24
- self.gouda_concurrency_config = {perform_limit:, enqueue_limit:, key:}
24
+ self.gouda_concurrency_config = {perform_limit: perform_limit, enqueue_limit: enqueue_limit, key: key}
25
25
  end
26
26
  end
27
27
 
@@ -72,7 +72,7 @@ module Gouda::Scheduler
72
72
  # `class` is a reserved keyword and a method that exists on every Ruby object so...
73
73
  cron_entry_params[:job_class] ||= cron_entry_params.delete(:class)
74
74
  params_with_defaults = defaults.merge(cron_entry_params)
75
- Entry.new(name:, **params_with_defaults)
75
+ Entry.new(name: name, **params_with_defaults)
76
76
  end
77
77
  end
78
78
 
data/lib/gouda/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gouda
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/gouda/worker.rb CHANGED
@@ -135,7 +135,7 @@ module Gouda
135
135
  break if check_shutdown.call
136
136
 
137
137
  did_process = Gouda.config.app_executor.wrap do
138
- Gouda::Workload.checkout_and_perform_one(executing_on: worker_id_and_thread_id, queue_constraint:, in_progress: executing_workload_ids)
138
+ Gouda::Workload.checkout_and_perform_one(executing_on: worker_id_and_thread_id, queue_constraint: queue_constraint, in_progress: executing_workload_ids)
139
139
  end
140
140
 
141
141
  # If no job was retrieved the queue is likely empty. Relax the polling then and ease off.
@@ -66,7 +66,7 @@ class Gouda::Workload < ActiveRecord::Base
66
66
  # Appsignal.increment_counter("gouda_workloads_revived", 1, job_class: workload.active_job_class_name)
67
67
 
68
68
  interrupted_at = workload.last_execution_heartbeat_at
69
- workload.update!(state: "finished", interrupted_at:, last_execution_heartbeat_at: Time.now.utc, execution_finished_at: Time.now.utc)
69
+ workload.update!(state: "finished", interrupted_at: interrupted_at, last_execution_heartbeat_at: Time.now.utc, execution_finished_at: Time.now.utc)
70
70
  revived_job = ActiveJob::Base.deserialize(workload.active_job_data)
71
71
  # Save the interrupted_at timestamp so that upon execution the new job will raise a Gouda::Interrpupted exception.
72
72
  # The exception can then be handled like any other ActiveJob exception (using rescue_from or similar).
@@ -116,7 +116,7 @@ class Gouda::Workload < ActiveRecord::Base
116
116
  uncached do # Necessary because we SELECT with a clock_timestamp() which otherwise gets cached by ActiveRecord query cache
117
117
  transaction do
118
118
  jobs.first.tap do |job|
119
- job&.update!(state: "executing", executing_on:, last_execution_heartbeat_at: Time.now.utc, execution_started_at: Time.now.utc)
119
+ job&.update!(state: "executing", executing_on: executing_on, last_execution_heartbeat_at: Time.now.utc, execution_started_at: Time.now.utc)
120
120
  end
121
121
  rescue ActiveRecord::RecordNotUnique
122
122
  # It can happen that due to a race the `execution_concurrency_key NOT IN` does not capture
@@ -133,7 +133,7 @@ class Gouda::Workload < ActiveRecord::Base
133
133
  # @param in_progress[#add,#delete] Used for tracking work in progress for heartbeats
134
134
  def self.checkout_and_perform_one(executing_on:, queue_constraint: Gouda::AnyQueue, in_progress: Set.new)
135
135
  # Select a job and mark it as "executing" which will make it unavailable to any other
136
- workload = checkout_and_lock_one(executing_on:, queue_constraint:)
136
+ workload = checkout_and_lock_one(executing_on: executing_on, queue_constraint: queue_constraint)
137
137
  if workload
138
138
  in_progress.add(workload.id)
139
139
  workload.perform_and_update_state!
data/lib/gouda.rb CHANGED
@@ -57,7 +57,7 @@ module Gouda
57
57
  Gouda.logger.info("Gouda version: #{Gouda::VERSION}")
58
58
  Gouda.logger.info("Worker threads: #{Gouda.config.worker_thread_count}")
59
59
 
60
- Gouda.worker_loop(n_threads: Gouda.config.worker_thread_count, queue_constraint:)
60
+ Gouda.worker_loop(n_threads: Gouda.config.worker_thread_count, queue_constraint: queue_constraint)
61
61
  end
62
62
 
63
63
  def self.config
data/tmp/.keep ADDED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gouda
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
  - Sebastian van Hesteren
@@ -123,7 +123,7 @@ dependencies:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
- description: Job Scheduler for Rails
126
+ description: Job Scheduler for Rails and PostgreSQL
127
127
  email:
128
128
  - sebastian@cheddar.me
129
129
  - me@julik.nl
@@ -157,6 +157,7 @@ files:
157
157
  - lib/gouda/version.rb
158
158
  - lib/gouda/worker.rb
159
159
  - lib/gouda/workload.rb
160
+ - tmp/.keep
160
161
  homepage: https://rubygems.org/gems/gouda
161
162
  licenses:
162
163
  - MIT
@@ -172,14 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  requirements:
173
174
  - - ">="
174
175
  - !ruby/object:Gem::Version
175
- version: 2.4.0
176
+ version: 2.7.0
176
177
  required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  requirements:
178
179
  - - ">="
179
180
  - !ruby/object:Gem::Version
180
181
  version: '0'
181
182
  requirements: []
182
- rubygems_version: 3.4.10
183
+ rubygems_version: 3.5.9
183
184
  signing_key:
184
185
  specification_version: 4
185
186
  summary: Job Scheduler