gouda 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/gouda/adapter.rb +1 -1
- data/lib/gouda/version.rb +1 -1
- data/lib/gouda/worker.rb +1 -1
- data/lib/gouda/workload.rb +3 -3
- data/lib/gouda.rb +2 -2
- data/test/gouda/gouda_test.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 760773cc030761badbc847c89278a501588ba47ff6106c8d4a3a71ae30aebaac
|
4
|
+
data.tar.gz: 5039b969fc5f258a898ab66c1f617d4bfdaa33bc29d69f285fd875e1e60617fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29cd1f3ea3ccba5b7995c3d32aed5c9a27d10b7609bee622edd7766ba2acee17a875b1a48f35e24d9bec42e7353f38451c35b79ae970994128ca2931a2e7ff1
|
7
|
+
data.tar.gz: 2c70d0d7a0a989c3d6e52ab87df3287831561a50e0ef766d4d18cf21939f06e47f19de48dd480ed2acffc340f727ad046a67e7cc6d6e37dfc3963f181f8742d8
|
data/CHANGELOG.md
CHANGED
data/lib/gouda/adapter.rb
CHANGED
@@ -83,7 +83,7 @@ class Gouda::Adapter
|
|
83
83
|
# Use batches of 500 so that we do not exceed the maximum statement size or do not create a transaction for the
|
84
84
|
# insert which times out
|
85
85
|
inserted_ids_and_positions = bulk_insert_attributes.each_slice(500).flat_map do |chunk|
|
86
|
-
Gouda.instrument(:insert_all, n_rows: chunk.size) do |payload|
|
86
|
+
Gouda.instrument(:insert_all, {n_rows: chunk.size}) do |payload|
|
87
87
|
rows = Gouda::Workload.insert_all(chunk, returning: [:id, :position_in_bulk])
|
88
88
|
payload[:inserted_jobs] = rows.length
|
89
89
|
payload[:rejected_jobs] = chunk.size - rows.length
|
data/lib/gouda/version.rb
CHANGED
data/lib/gouda/worker.rb
CHANGED
@@ -163,7 +163,7 @@ module Gouda
|
|
163
163
|
# Find jobs which just hung and clean them up (mark them as "finished" and enqueue replacement workloads if possible)
|
164
164
|
Gouda::Workload.reap_zombie_workloads
|
165
165
|
rescue => e
|
166
|
-
Gouda.instrument(:exception, exception: e)
|
166
|
+
Gouda.instrument(:exception, {exception: e})
|
167
167
|
|
168
168
|
warn "Uncaught exception during housekeeping (#{e.class} - #{e}"
|
169
169
|
end
|
data/lib/gouda/workload.rb
CHANGED
@@ -63,7 +63,7 @@ class Gouda::Workload < ActiveRecord::Base
|
|
63
63
|
workload.with_lock("FOR UPDATE SKIP LOCKED") do
|
64
64
|
Gouda.logger.info { "Reviving (re-enqueueing) Gouda workload #{workload.id} after interruption" }
|
65
65
|
|
66
|
-
Gouda.instrument(:workloads_revived_counter, size: 1, job_class: workload.active_job_class_name)
|
66
|
+
Gouda.instrument(:workloads_revived_counter, {size: 1, job_class: workload.active_job_class_name})
|
67
67
|
|
68
68
|
interrupted_at = workload.last_execution_heartbeat_at
|
69
69
|
workload.update!(state: "finished", interrupted_at: interrupted_at, last_execution_heartbeat_at: Time.now.utc, execution_finished_at: Time.now.utc)
|
@@ -110,7 +110,7 @@ class Gouda::Workload < ActiveRecord::Base
|
|
110
110
|
.lock("FOR UPDATE SKIP LOCKED")
|
111
111
|
.limit(1)
|
112
112
|
|
113
|
-
_first_available_workload =
|
113
|
+
_first_available_workload = ActiveSupport::Notifications.instrument(:checkout_and_lock_one, {queue_constraint: queue_constraint.to_sql}) do |payload|
|
114
114
|
payload[:condition_sql] = jobs.to_sql
|
115
115
|
payload[:retried_checkouts_due_to_concurrent_exec] = 0
|
116
116
|
uncached do # Necessary because we SELECT with a clock_timestamp() which otherwise gets cached by ActiveRecord query cache
|
@@ -147,7 +147,7 @@ class Gouda::Workload < ActiveRecord::Base
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def perform_and_update_state!
|
150
|
-
|
150
|
+
Gouda.instrument(:perform_job, {workload: self}) do |instrument_payload|
|
151
151
|
extras = {}
|
152
152
|
if Gouda::JobFuse.exists?(active_job_class_name: active_job_class_name)
|
153
153
|
extras[:error] = {class_name: "WorkloadSkippedError", message: "Skipped because of a fuse at #{Time.now.utc}"}
|
data/lib/gouda.rb
CHANGED
@@ -70,8 +70,8 @@ module Gouda
|
|
70
70
|
Gouda.config.logger
|
71
71
|
end
|
72
72
|
|
73
|
-
def self.instrument(channel,
|
74
|
-
ActiveSupport::Notifications.instrument("#{channel}.gouda",
|
73
|
+
def self.instrument(channel, options, &block)
|
74
|
+
ActiveSupport::Notifications.instrument("#{channel}.gouda", options, &block)
|
75
75
|
end
|
76
76
|
|
77
77
|
|
data/test/gouda/gouda_test.rb
CHANGED
@@ -647,7 +647,7 @@ class GoudaTest < ActiveSupport::TestCase
|
|
647
647
|
|
648
648
|
test "instrumentation" do
|
649
649
|
payload = subscribed_notification_for("workloads_revived_counter.gouda") do
|
650
|
-
Gouda.instrument(:workloads_revived_counter, size: 1, job_class: "test_class")
|
650
|
+
Gouda.instrument(:workloads_revived_counter, {size: 1, job_class: "test_class"})
|
651
651
|
end
|
652
652
|
|
653
653
|
assert_equal "test_class", payload[:job_class]
|