delayed_job 4.1.6.beta1 → 4.1.6

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
- SHA1:
3
- metadata.gz: 0f80efdc929cecb5ef874d86109e6858c1414c7c
4
- data.tar.gz: 0c563d9994ff8f85f8ebd72b7f4e60e38e2d8b0a
2
+ SHA256:
3
+ metadata.gz: b67418ad5fa9b6bb8f56f10ce7ef56bd350a9f6729932f891ef7153dfa77651b
4
+ data.tar.gz: 162d1df1447096b0f08ade405bccbfec41955b74e4abb54e5c338a08ecc4b7c1
5
5
  SHA512:
6
- metadata.gz: 81cff020b70c213e91b86e7af8df01e57cd67aa0837675cce4aa5664d7a6109cf706cfba8cfb420443bcec2caf0092fae3bdb308b9bf95e88ad9357168c736e4
7
- data.tar.gz: 98516a25aec89f676e945d2be722965566ba6a7be85dba600a272235e126f632e9918cbcbd43513196f7bd4bc5b4e4d2f651003801b0fe7e66df1681ba1cc3b9
6
+ metadata.gz: 132f728b6b4df3106a8fe49330aeecec2a96f905fe3af0b3c4749584b76f4bec657fe2b4510b41ef431a162b4eb4be4012f0124dc20e9c7a755f3442a15eae8e
7
+ data.tar.gz: c18a9b93033ab503923123a385d47c55c08270528fb6e5172b8fc6a8e723b7f01e32e0f1636b95750e6b2d5a3359a4331ab09c793e21fbf5b63b98d22e8d649d
@@ -1,7 +1,9 @@
1
- 4.1.6 - In Progress
1
+ 4.1.6 - 2019-06-19
2
2
  =================
3
- * Allow Rails 6.0
4
- * Update failed message to be more clear
3
+ * Properly initialize ActionMailer outside railties (#1077)
4
+ * Fix Psych load_tags support (#1093)
5
+ * Replace REMOVED with FAILED in log message (#1048)
6
+ * Misc doc updates (#1052, #1074, #1064, #1063)
5
7
 
6
8
  4.1.5 - 2018-04-13
7
9
  =================
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  **If you're viewing this at https://github.com/collectiveidea/delayed_job,
2
2
  you're reading the documentation for the master branch.
3
3
  [View documentation for the latest release
4
- (4.1.5).](https://github.com/collectiveidea/delayed_job/tree/v4.1.5)**
4
+ (4.1.6).](https://github.com/collectiveidea/delayed_job/tree/v4.1.6)**
5
5
 
6
6
  Delayed::Job
7
7
  ============
@@ -375,6 +375,9 @@ Hooks
375
375
  =====
376
376
  You can define hooks on your job that will be called at different stages in the process:
377
377
 
378
+
379
+ **NOTE:** If you are using ActiveJob these hooks are **not** available to your jobs. You will need to use ActiveJob's callbacks. You can find details here https://guides.rubyonrails.org/active_job_basics.html#callbacks
380
+
378
381
  ```ruby
379
382
  class ParanoidNewsletterJob < NewsletterJob
380
383
  def enqueue(job)
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.add_dependency 'activesupport', ['>= 3.0', '< 6.1']
4
+ spec.add_dependency 'activesupport', ['>= 3.0', '< 5.3']
5
5
  spec.authors = ['Brandon Keepers', 'Brian Ryckbost', 'Chris Gaffney', 'David Genord II', 'Erik Michaels-Ober', 'Matt Griffin', 'Steve Richert', 'Tobias Lütke']
6
6
  spec.description = 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.'
7
7
  spec.email = ['brian@collectiveidea.com']
@@ -13,5 +13,5 @@ Gem::Specification.new do |spec|
13
13
  spec.require_paths = ['lib']
14
14
  spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify'
15
15
  spec.test_files = Dir.glob('spec/**/*')
16
- spec.version = '4.1.6.beta1'
16
+ spec.version = '4.1.6'
17
17
  end
@@ -133,8 +133,7 @@ module Delayed
133
133
  end
134
134
 
135
135
  def fail!
136
- self.failed_at = self.class.db_time_now
137
- save!
136
+ update_attributes(:failed_at => self.class.db_time_now)
138
137
  end
139
138
 
140
139
  protected
@@ -523,8 +523,7 @@ shared_examples_for 'a delayed_job backend' do
523
523
  it 'reloads changed attributes' do
524
524
  story = Story.create(:text => 'hello')
525
525
  job = story.delay.tell
526
- story.text = 'goodbye'
527
- story.save!
526
+ story.update_attributes :text => 'goodbye'
528
527
  expect(job.reload.payload_object.object.text).to eq('goodbye')
529
528
  end
530
529
 
@@ -28,7 +28,13 @@ module Delayed
28
28
  end
29
29
 
30
30
  def visit_Psych_Nodes_Mapping(object) # rubocop:disable CyclomaticComplexity, MethodName, PerceivedComplexity
31
- return revive(Psych.load_tags[object.tag], object) if Psych.load_tags[object.tag]
31
+ klass = Psych.load_tags[object.tag]
32
+ if klass
33
+ # Implementation changed here https://github.com/ruby/psych/commit/2c644e184192975b261a81f486a04defa3172b3f
34
+ # load_tags used to have class values, now the values are strings
35
+ klass = resolve_class(klass) if klass.is_a?(String)
36
+ return revive(klass, object)
37
+ end
32
38
 
33
39
  case object.tag
34
40
  when %r{^!ruby/object}
@@ -4,10 +4,6 @@ require 'rails'
4
4
  module Delayed
5
5
  class Railtie < Rails::Railtie
6
6
  initializer :after_initialize do
7
- ActiveSupport.on_load(:action_mailer) do
8
- ActionMailer::Base.extend(Delayed::DelayMail)
9
- end
10
-
11
7
  Delayed::Worker.logger ||= if defined?(Rails)
12
8
  Rails.logger
13
9
  elsif defined?(RAILS_DEFAULT_LOGGER)
@@ -3,12 +3,6 @@ require 'delayed/compatibility'
3
3
  require 'delayed/exceptions'
4
4
  require 'delayed/message_sending'
5
5
  require 'delayed/performable_method'
6
-
7
- if defined?(ActionMailer)
8
- require 'action_mailer/version'
9
- require 'delayed/performable_mailer'
10
- end
11
-
12
6
  require 'delayed/yaml_ext'
13
7
  require 'delayed/lifecycle'
14
8
  require 'delayed/plugin'
@@ -19,5 +13,10 @@ require 'delayed/worker'
19
13
  require 'delayed/deserialization_error'
20
14
  require 'delayed/railtie' if defined?(Rails::Railtie)
21
15
 
16
+ ActiveSupport.on_load(:action_mailer) do
17
+ require 'delayed/performable_mailer'
18
+ ActionMailer::Base.extend(Delayed::DelayMail)
19
+ end
20
+
22
21
  Object.send(:include, Delayed::MessageSending)
23
22
  Module.send(:include, Delayed::MessageSendingClassMethods)
@@ -87,6 +87,11 @@ module Delayed
87
87
  Time.current
88
88
  end
89
89
 
90
+ def update_attributes(attrs = {})
91
+ attrs.each { |k, v| send(:"#{k}=", v) }
92
+ save
93
+ end
94
+
90
95
  def destroy
91
96
  self.class.all.delete(self)
92
97
  end
@@ -14,7 +14,6 @@ require 'logger'
14
14
  require 'rspec'
15
15
 
16
16
  require 'action_mailer'
17
- require 'active_support/dependencies'
18
17
  require 'active_record'
19
18
 
20
19
  require 'delayed_job'
@@ -45,9 +44,6 @@ Delayed::Worker.backend = :test
45
44
  # Add this directory so the ActiveSupport autoloading works
46
45
  ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
47
46
 
48
- # Add this to simulate Railtie initializer being executed
49
- ActionMailer::Base.extend(Delayed::DelayMail)
50
-
51
47
  # Used to test interactions between DJ and an ORM
52
48
  ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
53
49
  ActiveRecord::Base.logger = Delayed::Worker.logger
@@ -1,6 +1,5 @@
1
1
  require 'helper'
2
2
 
3
- require 'action_mailer'
4
3
  class MyMailer < ActionMailer::Base
5
4
  def signup(email)
6
5
  mail :to => email, :subject => 'Delaying Emails', :from => 'delayedjob@example.com', :body => 'Delaying Emails Body'
@@ -3,10 +3,32 @@ require 'helper'
3
3
  describe 'Psych::Visitors::ToRuby', :if => defined?(Psych::Visitors::ToRuby) do
4
4
  context BigDecimal do
5
5
  it 'deserializes correctly' do
6
- deserialized = YAML.load("--- !ruby/object:BigDecimal 18:0.1337E2\n...\n")
6
+ deserialized = YAML.load_dj("--- !ruby/object:BigDecimal 18:0.1337E2\n...\n")
7
7
 
8
8
  expect(deserialized).to be_an_instance_of(BigDecimal)
9
9
  expect(deserialized).to eq(BigDecimal('13.37'))
10
10
  end
11
11
  end
12
+
13
+ context 'load_tag handling' do
14
+ # This only broadly works in ruby 2.0 but will cleanly work through load_dj
15
+ # here because this class is so simple it only touches our extention
16
+ YAML.load_tags['!ruby/object:RenamedClass'] = SimpleJob
17
+ # This is how ruby 2.1 and newer works throughout the yaml handling
18
+ YAML.load_tags['!ruby/object:RenamedString'] = 'SimpleJob'
19
+
20
+ it 'deserializes class tag' do
21
+ deserialized = YAML.load_dj("--- !ruby/object:RenamedClass\ncheck: 12\n")
22
+
23
+ expect(deserialized).to be_an_instance_of(SimpleJob)
24
+ expect(deserialized.instance_variable_get(:@check)).to eq(12)
25
+ end
26
+
27
+ it 'deserializes string tag' do
28
+ deserialized = YAML.load_dj("--- !ruby/object:RenamedString\ncheck: 12\n")
29
+
30
+ expect(deserialized).to be_an_instance_of(SimpleJob)
31
+ expect(deserialized.instance_variable_get(:@check)).to eq(12)
32
+ end
33
+ end
12
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6.beta1
4
+ version: 4.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2019-02-18 00:00:00.000000000 Z
18
+ date: 2019-06-19 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
@@ -26,7 +26,7 @@ dependencies:
26
26
  version: '3.0'
27
27
  - - "<"
28
28
  - !ruby/object:Gem::Version
29
- version: '6.1'
29
+ version: '5.3'
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: !ruby/object:Gem::Requirement
@@ -36,7 +36,7 @@ dependencies:
36
36
  version: '3.0'
37
37
  - - "<"
38
38
  - !ruby/object:Gem::Version
39
- version: '6.1'
39
+ version: '5.3'
40
40
  description: Delayed_job (or DJ) encapsulates the common pattern of asynchronously
41
41
  executing longer tasks in the background. It is a direct extraction from Shopify
42
42
  where the job table is responsible for a multitude of core tasks.
@@ -114,12 +114,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ">"
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: 1.3.1
119
+ version: '0'
120
120
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.6.14
121
+ rubygems_version: 3.0.3
123
122
  signing_key:
124
123
  specification_version: 4
125
124
  summary: Database-backed asynchronous priority queue system -- Extracted from Shopify