mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 04:52:43 +08:00
DEV: Fix job serialization warnings (#30735)
(…and remove extraneous `stringify_keys` - enqueue already does `deep_stringify_keys`) The warning in question: ``` Deprecation notice: Jobs::RunProblemCheck was enqueued with argument values which do not cleanly serialize to/from JSON. This means that the job will be run with slightly different values than the ones supplied to `enqueue`. Argument values should be strings, booleans, numbers, or nil (or arrays/hashes of those value types). (deprecated since Discourse 2.9) (removal in Discourse 3.0) ```
This commit is contained in:
parent
1f483f48a0
commit
b28fafd372
|
@ -22,7 +22,7 @@ module Jobs
|
||||||
Jobs.enqueue_in(
|
Jobs.enqueue_in(
|
||||||
check.retry_after,
|
check.retry_after,
|
||||||
:run_problem_check,
|
:run_problem_check,
|
||||||
args.merge(retry_count: retry_count + 1).stringify_keys,
|
args.merge(retry_count: retry_count + 1),
|
||||||
)
|
)
|
||||||
rescue StandardError => err
|
rescue StandardError => err
|
||||||
Discourse.warn_exception(
|
Discourse.warn_exception(
|
||||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe Jobs::RunProblemCheck do
|
||||||
|
|
||||||
it "updates the problem check tracker" do
|
it "updates the problem check tracker" do
|
||||||
expect {
|
expect {
|
||||||
described_class.new.execute(check_identifier: :test_check, retry_count: 0)
|
described_class.new.execute(check_identifier: "test_check", retry_count: 0)
|
||||||
}.to change { ProblemCheckTracker.failing.count }.by(1)
|
}.to change { ProblemCheckTracker.failing.count }.by(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,7 +53,7 @@ RSpec.describe Jobs::RunProblemCheck do
|
||||||
|
|
||||||
it "does not yet update the problem check tracker" do
|
it "does not yet update the problem check tracker" do
|
||||||
expect {
|
expect {
|
||||||
described_class.new.execute(check_identifier: :test_check, retry_count: 1)
|
described_class.new.execute(check_identifier: "test_check", retry_count: 1)
|
||||||
}.not_to change { ProblemCheckTracker.where("blips > ?", 0).count }
|
}.not_to change { ProblemCheckTracker.where("blips > ?", 0).count }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ RSpec.describe Jobs::RunProblemCheck do
|
||||||
expect_enqueued_with(
|
expect_enqueued_with(
|
||||||
job: :run_problem_check,
|
job: :run_problem_check,
|
||||||
args: {
|
args: {
|
||||||
check_identifier: :test_check,
|
check_identifier: "test_check",
|
||||||
retry_count: 1,
|
retry_count: 1,
|
||||||
},
|
},
|
||||||
) { described_class.new.execute(check_identifier: :test_check) }
|
) { described_class.new.execute(check_identifier: "test_check") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ RSpec.describe Jobs::RunProblemCheck do
|
||||||
|
|
||||||
it "updates the problem check tracker" do
|
it "updates the problem check tracker" do
|
||||||
expect {
|
expect {
|
||||||
described_class.new.execute(check_identifier: :test_check, retry_count: 1)
|
described_class.new.execute(check_identifier: "test_check", retry_count: 1)
|
||||||
}.to change { ProblemCheckTracker.where("blips > ?", 0).count }.by(1)
|
}.to change { ProblemCheckTracker.where("blips > ?", 0).count }.by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not schedule a retry" do
|
it "does not schedule a retry" do
|
||||||
expect_not_enqueued_with(job: :run_problem_check) do
|
expect_not_enqueued_with(job: :run_problem_check) do
|
||||||
described_class.new.execute(check_identifier: :test_check, retry_count: 1)
|
described_class.new.execute(check_identifier: "test_check", retry_count: 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user