delayed_job_active_record 4.1.4 → 4.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/delayed_job_active_record.gemspec +2 -2
- data/lib/delayed/backend/active_record.rb +6 -3
- data/lib/delayed/backend/active_record/railtie.rb +14 -0
- data/lib/delayed_job_active_record.rb +8 -3
- data/lib/generators/delayed_job/templates/migration.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1799d6d0f6301b5285da09c332bfe6abeb6cfb60b410a29e93f94a99aa0313b7
|
4
|
+
data.tar.gz: a1b0adfed07a2a7f47603390156688e193aed7bcc187184c9812b72e182fb859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c17b88c4d64f8698405c1cf9918b887baecbd2366d42a71d4d02879227d339aba4de0ba3419fc3a4cc0272b193769709efb86fd95f251a08afa4e9c00d07ac58
|
7
|
+
data.tar.gz: 9d8bc65f7e959d71264c8d46d2cff8c2409a975755be9c5a9f0387d033bf1054d76c20e56a0dd685f7556b9cde282dd7c76818f733c9ad9e28fc9e7cbaa67da1
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
**If you're viewing this at https://github.com/collectiveidea/delayed_job_active_record,
|
2
2
|
you're reading the documentation for the master branch.
|
3
3
|
[View documentation for the latest release
|
4
|
-
(4.1.
|
4
|
+
(4.1.5).](https://github.com/collectiveidea/delayed_job_active_record/tree/v4.1.5)**
|
5
5
|
|
6
6
|
# DelayedJob ActiveRecord Backend
|
7
7
|
|
8
8
|
[![Gem Version](https://img.shields.io/gem/v/delayed_job_active_record.svg)](https://rubygems.org/gems/delayed_job_active_record)
|
9
|
-
|
9
|
+
![CI](https://github.com/collectiveidea/delayed_job_active_record/workflows/CI/badge.svg)
|
10
10
|
[![Coverage Status](https://img.shields.io/coveralls/collectiveidea/delayed_job_active_record.svg)](https://coveralls.io/r/collectiveidea/delayed_job_active_record)
|
11
11
|
|
12
12
|
## Installation
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
-
spec.add_dependency "activerecord", [">= 3.0", "< 6.
|
4
|
+
spec.add_dependency "activerecord", [">= 3.0", "< 6.2"]
|
5
5
|
spec.add_dependency "delayed_job", [">= 3.0", "< 5"]
|
6
6
|
spec.authors = ["Brian Ryckbost", "Matt Griffin", "Erik Michaels-Ober"]
|
7
7
|
spec.description = "ActiveRecord backend for Delayed::Job, originally authored by Tobias Lütke"
|
@@ -12,5 +12,5 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.name = "delayed_job_active_record"
|
13
13
|
spec.require_paths = ["lib"]
|
14
14
|
spec.summary = "ActiveRecord backend for DelayedJob"
|
15
|
-
spec.version = "4.1.
|
15
|
+
spec.version = "4.1.5"
|
16
16
|
end
|
@@ -54,7 +54,7 @@ module Delayed
|
|
54
54
|
|
55
55
|
def self.ready_to_run(worker_name, max_run_time)
|
56
56
|
where(
|
57
|
-
"(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL",
|
57
|
+
"((run_at <= ? AND (locked_at IS NULL OR locked_at < ?)) OR locked_by = ?) AND failed_at IS NULL",
|
58
58
|
db_time_now,
|
59
59
|
db_time_now - max_run_time,
|
60
60
|
worker_name
|
@@ -112,8 +112,11 @@ module Delayed
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def self.reserve_with_scope_using_default_sql(ready_scope, worker, now)
|
115
|
-
# This is our old fashion, tried and true, but slower lookup
|
116
|
-
|
115
|
+
# This is our old fashion, tried and true, but possibly slower lookup
|
116
|
+
# Instead of reading the entire job record for our detect loop, we select only the id,
|
117
|
+
# and only read the full job record after we've successfully locked the job.
|
118
|
+
# This can have a noticable impact on large read_ahead configurations and large payload jobs.
|
119
|
+
ready_scope.limit(worker.read_ahead).select(:id).detect do |job|
|
117
120
|
count = ready_scope.where(id: job.id).update_all(locked_at: now, locked_by: worker.name)
|
118
121
|
count == 1 && job.reload
|
119
122
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Delayed
|
4
|
+
module Backend
|
5
|
+
module ActiveRecord
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
config.after_initialize do
|
8
|
+
require "delayed/backend/active_record"
|
9
|
+
Delayed::Worker.backend = :active_record
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,7 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "active_record"
|
4
3
|
require "delayed_job"
|
5
|
-
require "delayed/backend/active_record"
|
6
4
|
|
7
|
-
|
5
|
+
if defined?(Rails::Railtie)
|
6
|
+
require "delayed/backend/active_record/railtie"
|
7
|
+
else
|
8
|
+
require "active_record"
|
9
|
+
require "delayed/backend/active_record"
|
10
|
+
|
11
|
+
Delayed::Worker.backend = :active_record
|
12
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateDelayedJobs < ActiveRecord::Migration<%= migration_version %>
|
2
2
|
def self.up
|
3
|
-
create_table :delayed_jobs
|
3
|
+
create_table :delayed_jobs do |table|
|
4
4
|
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
|
5
5
|
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
|
6
6
|
table.text :handler, null: false # YAML-encoded string of the object that will do work
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Ryckbost
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-12-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '6.
|
24
|
+
version: '6.2'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
version: '3.0'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '6.
|
34
|
+
version: '6.2'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: delayed_job
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- delayed_job_active_record.gemspec
|
69
69
|
- lib/delayed/backend/active_record.rb
|
70
|
+
- lib/delayed/backend/active_record/railtie.rb
|
70
71
|
- lib/delayed_job_active_record.rb
|
71
72
|
- lib/generators/delayed_job/active_record_generator.rb
|
72
73
|
- lib/generators/delayed_job/next_migration_version.rb
|