inst-jobs 3.0.10 → 3.0.12
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee779fa187d057bce265940ca1c9c2944bdf096ab198060e0819ff40dd02358b
|
|
4
|
+
data.tar.gz: bc930f9dc0ca659df54388753dc9aa26402c866023b7f275155897ccca35ebf4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd24bd19e153cb7f48b33911e38fbd9657de396baad1c32286d5a4acb899d23f9d97c627914c095647006129f5c0ebc008e7e07b311f3d33b89819e400cce756
|
|
7
|
+
data.tar.gz: 005e7e0a637b1e5a3fcae2b7e22edfb2af604da2328e273f512b4747dacb4d723afc06bd4846246c3fc541f72ca7068123c98bf26b52e2964f7eaa45dba6b609
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddFailedJobsIndicies < ActiveRecord::Migration[5.2]
|
|
4
|
+
disable_ddl_transaction!
|
|
5
|
+
|
|
6
|
+
def change
|
|
7
|
+
add_index :failed_jobs, :failed_at, algorithm: :concurrently
|
|
8
|
+
add_index :failed_jobs, :strand, where: "strand IS NOT NULL", algorithm: :concurrently
|
|
9
|
+
add_index :failed_jobs, :singleton, where: "singleton IS NOT NULL", algorithm: :concurrently
|
|
10
|
+
add_index :failed_jobs, :tag, algorithm: :concurrently
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -579,6 +579,10 @@ module Delayed
|
|
|
579
579
|
class Failed < Job
|
|
580
580
|
include Delayed::Backend::Base
|
|
581
581
|
self.table_name = :failed_jobs
|
|
582
|
+
|
|
583
|
+
def self.cleanup_old_jobs(before_date, batch_size: 10_000)
|
|
584
|
+
where("failed_at < ?", before_date).in_batches(of: batch_size).delete_all
|
|
585
|
+
end
|
|
582
586
|
end
|
|
583
587
|
end
|
|
584
588
|
end
|
data/lib/delayed/version.rb
CHANGED
|
@@ -100,6 +100,15 @@ describe "Delayed::Backed::ActiveRecord::Job" do
|
|
|
100
100
|
failed_count = Delayed::Job::Failed.count
|
|
101
101
|
expect(Delayed::Job.bulk_update("destroy", flavor: "failed", query: @query)).to eq(failed_count)
|
|
102
102
|
end
|
|
103
|
+
|
|
104
|
+
it "deletes all failed jobs before a given date" do
|
|
105
|
+
Delayed::Job::Failed.first.update!(failed_at: 3.hours.ago)
|
|
106
|
+
Delayed::Job::Failed.last.update!(failed_at: 1.hour.ago)
|
|
107
|
+
|
|
108
|
+
expect(Delayed::Job::Failed.count).to eq 2
|
|
109
|
+
Delayed::Job::Failed.cleanup_old_jobs(2.hours.ago)
|
|
110
|
+
expect(Delayed::Job::Failed.count).to eq 1
|
|
111
|
+
end
|
|
103
112
|
end
|
|
104
113
|
end
|
|
105
114
|
|
|
@@ -389,7 +389,7 @@ shared_examples_for "a backend" do
|
|
|
389
389
|
expect(job1.reload.handler).to include("ErrorJob")
|
|
390
390
|
end
|
|
391
391
|
|
|
392
|
-
context "next_in_strand management - deadlocks and race conditions", non_transactional: true do
|
|
392
|
+
context "next_in_strand management - deadlocks and race conditions", non_transactional: true, slow: true do
|
|
393
393
|
# The following unit tests are fairly slow and non-deterministic. It may be
|
|
394
394
|
# easier to make them fail quicker and more consistently by adding a random
|
|
395
395
|
# sleep into the appropriate trigger(s).
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inst-jobs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cody Cutrer
|
|
8
8
|
- Ethan Vizitei
|
|
9
9
|
- Jacob Burroughs
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2022-03-
|
|
13
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activerecord
|
|
@@ -410,7 +410,7 @@ dependencies:
|
|
|
410
410
|
- - ">="
|
|
411
411
|
- !ruby/object:Gem::Version
|
|
412
412
|
version: '0'
|
|
413
|
-
description:
|
|
413
|
+
description:
|
|
414
414
|
email:
|
|
415
415
|
- cody@instructure.com
|
|
416
416
|
- evizitei@instructure.com
|
|
@@ -459,6 +459,7 @@ files:
|
|
|
459
459
|
- db/migrate/20220128084800_update_insert_trigger_for_singleton_unique_constraint_change.rb
|
|
460
460
|
- db/migrate/20220128084900_update_delete_trigger_for_singleton_unique_constraint_change.rb
|
|
461
461
|
- db/migrate/20220203063200_remove_old_singleton_index.rb
|
|
462
|
+
- db/migrate/20220328152900_add_failed_jobs_indicies.rb
|
|
462
463
|
- exe/inst_jobs
|
|
463
464
|
- lib/delayed/backend/active_record.rb
|
|
464
465
|
- lib/delayed/backend/base.rb
|
|
@@ -526,7 +527,7 @@ homepage: https://github.com/instructure/inst-jobs
|
|
|
526
527
|
licenses: []
|
|
527
528
|
metadata:
|
|
528
529
|
rubygems_mfa_required: 'true'
|
|
529
|
-
post_install_message:
|
|
530
|
+
post_install_message:
|
|
530
531
|
rdoc_options: []
|
|
531
532
|
require_paths:
|
|
532
533
|
- lib
|
|
@@ -541,32 +542,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
541
542
|
- !ruby/object:Gem::Version
|
|
542
543
|
version: '0'
|
|
543
544
|
requirements: []
|
|
544
|
-
rubygems_version: 3.1.
|
|
545
|
-
signing_key:
|
|
545
|
+
rubygems_version: 3.1.6
|
|
546
|
+
signing_key:
|
|
546
547
|
specification_version: 4
|
|
547
548
|
summary: Instructure-maintained fork of delayed_job
|
|
548
549
|
test_files:
|
|
549
|
-
- spec/
|
|
550
|
-
- spec/spec_helper.rb
|
|
551
|
-
- spec/shared_jobs_specs.rb
|
|
552
|
-
- spec/shared/performable_method.rb
|
|
553
|
-
- spec/shared/testing.rb
|
|
554
|
-
- spec/shared/delayed_batch.rb
|
|
555
|
-
- spec/shared/worker.rb
|
|
556
|
-
- spec/shared/delayed_method.rb
|
|
557
|
-
- spec/shared/shared_backend.rb
|
|
558
|
-
- spec/migrate/20140924140513_add_story_table.rb
|
|
559
|
-
- spec/delayed/server_spec.rb
|
|
550
|
+
- spec/active_record_job_spec.rb
|
|
560
551
|
- spec/delayed/cli_spec.rb
|
|
561
552
|
- spec/delayed/daemon_spec.rb
|
|
562
|
-
- spec/delayed/worker_spec.rb
|
|
563
|
-
- spec/delayed/periodic_spec.rb
|
|
564
553
|
- spec/delayed/message_sending_spec.rb
|
|
554
|
+
- spec/delayed/periodic_spec.rb
|
|
555
|
+
- spec/delayed/server_spec.rb
|
|
565
556
|
- spec/delayed/settings_spec.rb
|
|
566
557
|
- spec/delayed/work_queue/in_process_spec.rb
|
|
567
|
-
- spec/delayed/work_queue/parent_process_spec.rb
|
|
568
558
|
- spec/delayed/work_queue/parent_process/client_spec.rb
|
|
569
559
|
- spec/delayed/work_queue/parent_process/server_spec.rb
|
|
570
|
-
- spec/delayed/
|
|
560
|
+
- spec/delayed/work_queue/parent_process_spec.rb
|
|
571
561
|
- spec/delayed/worker/consul_health_check_spec.rb
|
|
572
|
-
- spec/
|
|
562
|
+
- spec/delayed/worker/health_check_spec.rb
|
|
563
|
+
- spec/delayed/worker_spec.rb
|
|
564
|
+
- spec/migrate/20140924140513_add_story_table.rb
|
|
565
|
+
- spec/sample_jobs.rb
|
|
566
|
+
- spec/shared/delayed_batch.rb
|
|
567
|
+
- spec/shared/delayed_method.rb
|
|
568
|
+
- spec/shared/performable_method.rb
|
|
569
|
+
- spec/shared/shared_backend.rb
|
|
570
|
+
- spec/shared/testing.rb
|
|
571
|
+
- spec/shared/worker.rb
|
|
572
|
+
- spec/shared_jobs_specs.rb
|
|
573
|
+
- spec/spec_helper.rb
|