delayed_job_mongoid 2.3.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -32
- data/CONTRIBUTING.md +14 -14
- data/LICENSE.md +20 -20
- data/README.md +46 -32
- data/delayed_job_mongoid.gemspec +13 -14
- data/lib/delayed/backend/mongoid.rb +95 -95
- data/lib/delayed/serialization/mongoid.rb +25 -25
- data/lib/delayed/yaml/psych_ext.rb +14 -14
- data/lib/delayed/yaml/yaml_ext.rb +3 -3
- data/lib/delayed_job_mongoid.rb +6 -7
- metadata +8 -30
- data/lib/delayed/plugins.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b064ab7ba80fe92ea75e98eed301b6d066e0b899d99dfe59a98a4a00183504b
|
4
|
+
data.tar.gz: bc12a94026c8fb0cae07a93a174678892bab73f91e670223c3c64b33bb6cd5d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 005b50b5063f7739679b785d7367c5cf80dc3f3d5315fdc97e55174d96ce17024c153e6e5f6ceaa6173c41dc10555af282358cd80938bfac427c6e7a45868c7f
|
7
|
+
data.tar.gz: 7ad70b9500041292afbdb4388f21509afb06d6197db866b0165c70927d236e16d1f4f4bb12bb42dab4c14eb79941cce464df77efe9ca8683a626f7d81cd017fa
|
data/CHANGELOG.md
CHANGED
@@ -1,32 +1,43 @@
|
|
1
|
-
###
|
2
|
-
|
3
|
-
*
|
4
|
-
|
5
|
-
###
|
6
|
-
|
7
|
-
* [#
|
8
|
-
* [#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
*
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
*
|
1
|
+
### 3.0.1
|
2
|
+
|
3
|
+
* Your contribution here.
|
4
|
+
|
5
|
+
### 3.0.0
|
6
|
+
|
7
|
+
* [#81](https://github.com/collectiveidea/delayed_job_mongoid/pull/81): Drop support for Mongoid 3.0 and 4.0 - [johnnyshields](https://github.com/johnnyshields).
|
8
|
+
* [#82](https://github.com/collectiveidea/delayed_job_mongoid/pull/82): Correctly handle before_fork and after_fork hooks - [johnnyshields](https://github.com/johnnyshields).
|
9
|
+
* [#85](https://github.com/collectiveidea/delayed_job_mongoid/pull/85): Add additional indexes - [johnnyshields](https://github.com/johnnyshields).
|
10
|
+
* [#87](https://github.com/collectiveidea/delayed_job_mongoid/pull/87): Convert Travis CI to GH Actions - [johnnyshields](https://github.com/johnnyshields).
|
11
|
+
|
12
|
+
### 2.3.1 (2019/02/26)
|
13
|
+
|
14
|
+
* [#77](https://github.com/collectiveidea/delayed_job_mongoid/pull/77): Support Mongoid 7.0 - [Startouf](https://github.com/Startouf).
|
15
|
+
|
16
|
+
### 2.3.0 (2017/02/13)
|
17
|
+
|
18
|
+
* [#72](https://github.com/collectiveidea/delayed_job_mongoid/pull/72): Fix: Unknown alias: 1 (Psych::BadAlias) when referencing an object twice from the object being serialized - [@dblock](https://github.com/dblock), [@maxjacobson](https://github.com/maxjacobson).
|
19
|
+
* [#71](https://github.com/collectiveidea/delayed_job_mongoid/pull/71): Support Mongoid 6.0 - [@dblock](https://github.com/dblock).
|
20
|
+
|
21
|
+
### 2.2.0 (2015/09/24)
|
22
|
+
|
23
|
+
* [#58](https://github.com/collectiveidea/delayed_job_mongoid/pull/58): Support Mongoid 5.0 - [@sferik](https://github.com/sferik).
|
24
|
+
|
25
|
+
### 2.1.0 (2014/05/09)
|
26
|
+
|
27
|
+
* [#38](https://github.com/collectiveidea/delayed_job_mongoid/pull/38): Fix clearing identity map before each job - [@srleo](https://github.com/srleo).
|
28
|
+
* [#43](https://github.com/collectiveidea/delayed_job_mongoid/pull/43): Compatibility with Mongoid 4.x and Delayed Job 4.x - [@dblock](https://github.com/dblock).
|
29
|
+
|
30
|
+
### 2.0.0 (2012/08/02)
|
31
|
+
|
32
|
+
* Added code coverage with SimpleCov - [@sferik](https://github.com/sferik).
|
33
|
+
* Added Mongoid 3.0 support - [@sferik](https://github.com/sferik), [@asavartsov](https://github.com/asavartsov).
|
34
|
+
|
35
|
+
### 1.0.2 (2010/01/12)
|
36
|
+
|
37
|
+
* Fix a potential memory leak inside mongo when reserving jobs on mongo 1.6+
|
38
|
+
* Fixed gemspec to work with Mongoid 2.0 RC and Rubygems 1.4
|
39
|
+
|
40
|
+
### 1.0.1 (2010/12/01)
|
41
|
+
|
42
|
+
* Use MongoDB's findAndModify to reserve the next available job in one atomic operation - [@beljun](https://github.com/beljun).
|
43
|
+
* Better index
|
data/CONTRIBUTING.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
## How to contribute
|
2
|
-
|
3
|
-
If you find what looks like a bug:
|
4
|
-
|
5
|
-
* Search the [mailing list](http://groups.google.com/group/delayed_job) to see if anyone else had the same issue.
|
6
|
-
* Check the [GitHub issue tracker](http://github.com/collectiveidea/delayed_job_mongoid/issues/) to see if anyone else has reported issue.
|
7
|
-
* If you don't see anything, create an issue with information on how to reproduce it.
|
8
|
-
|
9
|
-
If you want to contribute an enhancement or a fix:
|
10
|
-
|
11
|
-
* Fork the project on github.
|
12
|
-
* Make your changes with tests.
|
13
|
-
* Commit the changes without making changes to the Rakefile or any other files that aren't related to your enhancement or fix
|
14
|
-
* Send a pull request.
|
1
|
+
## How to contribute
|
2
|
+
|
3
|
+
If you find what looks like a bug:
|
4
|
+
|
5
|
+
* Search the [mailing list](http://groups.google.com/group/delayed_job) to see if anyone else had the same issue.
|
6
|
+
* Check the [GitHub issue tracker](http://github.com/collectiveidea/delayed_job_mongoid/issues/) to see if anyone else has reported issue.
|
7
|
+
* If you don't see anything, create an issue with information on how to reproduce it.
|
8
|
+
|
9
|
+
If you want to contribute an enhancement or a fix:
|
10
|
+
|
11
|
+
* Fork the project on github.
|
12
|
+
* Make your changes with tests.
|
13
|
+
* Commit the changes without making changes to the Rakefile or any other files that aren't related to your enhancement or fix
|
14
|
+
* Send a pull request.
|
data/LICENSE.md
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright © 2010-2017 Collective Idea & Contributors
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright © 2010-2017 Collective Idea & Contributors
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,32 +1,46 @@
|
|
1
|
-
# DelayedJob Mongoid backend
|
2
|
-
|
3
|
-
[![Gem Version]
|
4
|
-
[![Build Status]
|
5
|
-
[![Code Climate]
|
6
|
-
[![Coverage
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Mongoid 3
|
16
|
-
|
17
|
-
## Installation
|
18
|
-
|
19
|
-
Add the gem to your Gemfile:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
1
|
+
# DelayedJob Mongoid backend
|
2
|
+
|
3
|
+
[![Gem Version][gem-img]][gem-url]
|
4
|
+
[![Build Status][ghactions-img]][ghactions-url]
|
5
|
+
[![Code Climate][codeclimate-img]][codeclimate-url]
|
6
|
+
[![Coverage][coveralls-img]][coveralls-url]
|
7
|
+
|
8
|
+
## Requirements
|
9
|
+
|
10
|
+
Delayed Job Mongoid supports the following dependency versions:
|
11
|
+
|
12
|
+
- Ruby 2.3+
|
13
|
+
- Mongoid 5+
|
14
|
+
|
15
|
+
For Mongoid 3 and 4, use 2.x version of this gem.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Add the gem to your Gemfile:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem 'delayed_job_mongoid'
|
23
|
+
```
|
24
|
+
|
25
|
+
Then create the indexes (don't forget to do this in production):
|
26
|
+
|
27
|
+
```
|
28
|
+
script/rails runner 'Delayed::Backend::Mongoid::Job.create_indexes'
|
29
|
+
```
|
30
|
+
|
31
|
+
To generate `script/delayed_job`:
|
32
|
+
|
33
|
+
```
|
34
|
+
rails generate delayed_job
|
35
|
+
```
|
36
|
+
|
37
|
+
That's it. Use [delayed_job](http://github.com/collectiveidea/delayed_job) as normal.
|
38
|
+
|
39
|
+
[gem-img]: https://badge.fury.io/rb/delayed_job_mongoid.svg
|
40
|
+
[gem-url]: https://rubygems.org/gems/delayed_job_mongoid
|
41
|
+
[ghactions-img]: https://github.com/collectiveidea/delayed_job_mongoid/actions/workflows/test.yml/badge.svg?query=branch%3Amaster
|
42
|
+
[ghactions-url]: https://github.com/collectiveidea/delayed_job_mongoid/actions/workflows/test.yml?query=branch%3Amaster
|
43
|
+
[codeclimate-img]: https://codeclimate.com/github/collectiveidea/delayed_job_mongoid.svg
|
44
|
+
[codeclimate-url]: https://codeclimate.com/github/collectiveidea/delayed_job_mongoid
|
45
|
+
[coveralls-img]: https://coveralls.io/github/collectiveidea/delayed_job_mongoid/badge.svg?branch=master
|
46
|
+
[coveralls-url]: https://coveralls.io/github/collectiveidea/delayed_job_mongoid?branch=master
|
data/delayed_job_mongoid.gemspec
CHANGED
@@ -1,14 +1,13 @@
|
|
1
|
-
Gem::Specification.new do |spec|
|
2
|
-
spec.add_dependency 'delayed_job', ['>= 3.0', '< 5']
|
3
|
-
spec.add_dependency 'mongoid',
|
4
|
-
spec.
|
5
|
-
spec.
|
6
|
-
spec.
|
7
|
-
spec.
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
|
14
|
-
end
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.add_dependency 'delayed_job', ['>= 3.0', '< 5']
|
3
|
+
spec.add_dependency 'mongoid', '>= 5.0'
|
4
|
+
spec.authors = ['Chris Gaffney', 'Brandon Keepers', 'Erik Michaels-Ober']
|
5
|
+
spec.email = %w[chris@collectiveidea.com brandon@opensoul.com sferik@gmail.com]
|
6
|
+
spec.files = %w[CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md delayed_job_mongoid.gemspec] + Dir['lib/**/*.rb']
|
7
|
+
spec.homepage = 'http://github.com/collectiveidea/delayed_job_mongoid'
|
8
|
+
spec.licenses = ['MIT']
|
9
|
+
spec.name = 'delayed_job_mongoid'
|
10
|
+
spec.require_paths = ['lib']
|
11
|
+
spec.summary = 'Mongoid backend for delayed_job'
|
12
|
+
spec.version = '3.0.0'
|
13
|
+
end
|
@@ -1,95 +1,95 @@
|
|
1
|
-
require 'delayed_job'
|
2
|
-
require 'mongoid'
|
3
|
-
|
4
|
-
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
include ::Mongoid::
|
10
|
-
include ::
|
11
|
-
|
12
|
-
|
13
|
-
field :
|
14
|
-
field :
|
15
|
-
field :
|
16
|
-
field :
|
17
|
-
field :
|
18
|
-
field :
|
19
|
-
field :
|
20
|
-
field :
|
21
|
-
|
22
|
-
|
23
|
-
index locked_by: -1, priority: 1, run_at: 1
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
criteria
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
1
|
+
require 'delayed_job'
|
2
|
+
require 'mongoid'
|
3
|
+
|
4
|
+
module Delayed
|
5
|
+
module Backend
|
6
|
+
module Mongoid
|
7
|
+
class Job
|
8
|
+
include ::Mongoid::Document
|
9
|
+
include ::Mongoid::Timestamps
|
10
|
+
include Delayed::Backend::Base
|
11
|
+
|
12
|
+
field :priority, type: Integer, default: 0
|
13
|
+
field :attempts, type: Integer, default: 0
|
14
|
+
field :handler, type: String
|
15
|
+
field :run_at, type: Time
|
16
|
+
field :locked_at, type: Time
|
17
|
+
field :locked_by, type: String
|
18
|
+
field :failed_at, type: Time
|
19
|
+
field :last_error, type: String
|
20
|
+
field :queue, type: String
|
21
|
+
|
22
|
+
index locked_by: -1, priority: 1, run_at: 1
|
23
|
+
index queue: 1, locked_by: -1, priority: 1, run_at: 1
|
24
|
+
index failed_at: 1, locked_by: -1, priority: 1, run_at: 1
|
25
|
+
index failed_at: 1, queue: 1, locked_by: -1, priority: 1, run_at: 1
|
26
|
+
|
27
|
+
before_save :set_default_run_at
|
28
|
+
|
29
|
+
def reload(*args)
|
30
|
+
reset
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def db_time_now
|
36
|
+
Time.now.utc
|
37
|
+
end
|
38
|
+
|
39
|
+
# Reserves one job for the worker.
|
40
|
+
# Atomically picks and locks one job from the collection.
|
41
|
+
def reserve(worker, max_run_time = Worker.max_run_time)
|
42
|
+
right_now = db_time_now
|
43
|
+
criteria = reservation_criteria(worker, right_now, max_run_time)
|
44
|
+
criteria.find_one_and_update(
|
45
|
+
{ '$set' => { locked_at: right_now, locked_by: worker.name } },
|
46
|
+
return_document: :after
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# When a worker is exiting, make sure we don't have any locked jobs.
|
51
|
+
def clear_locks!(worker_name)
|
52
|
+
where(locked_by: worker_name).update_all(locked_at: nil, locked_by: nil)
|
53
|
+
end
|
54
|
+
|
55
|
+
# In a multi-process setup, this will be called at boot time
|
56
|
+
# to close unnecessary database connections on the parent process.
|
57
|
+
def before_fork
|
58
|
+
::Mongoid.disconnect_clients
|
59
|
+
end
|
60
|
+
|
61
|
+
# In a multi-process setup, this will be called to ensure fresh
|
62
|
+
# database connections are immediately made on each newly spawned child process.
|
63
|
+
def after_fork
|
64
|
+
::Mongoid::Clients.clients.each do |_name, client|
|
65
|
+
client.close
|
66
|
+
client.reconnect
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
# Mongo criteria matching all the jobs the worker can reserve.
|
73
|
+
# Jobs are sorted by priority and run_at.
|
74
|
+
def reservation_criteria(worker, right_now, max_run_time)
|
75
|
+
criteria = where(
|
76
|
+
run_at: { '$lte' => right_now },
|
77
|
+
failed_at: nil
|
78
|
+
).any_of(
|
79
|
+
{ locked_by: worker.name },
|
80
|
+
{ locked_at: nil },
|
81
|
+
locked_at: { '$lt' => (right_now - max_run_time) }
|
82
|
+
)
|
83
|
+
|
84
|
+
criteria = criteria.gte(priority: Worker.min_priority.to_i) if Worker.min_priority
|
85
|
+
criteria = criteria.lte(priority: Worker.max_priority.to_i) if Worker.max_priority
|
86
|
+
criteria = criteria.any_in(queue: Worker.queues) if Worker.queues.any?
|
87
|
+
criteria = criteria.desc(:locked_by).asc(:priority).asc(:run_at)
|
88
|
+
|
89
|
+
criteria
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -1,25 +1,25 @@
|
|
1
|
-
require 'delayed_job'
|
2
|
-
require 'mongoid'
|
3
|
-
|
4
|
-
if YAML.parser.class.name =~ /syck/i
|
5
|
-
Mongoid::Document.class_eval do
|
6
|
-
yaml_as 'tag:ruby.yaml.org,2002:Mongoid'
|
7
|
-
|
8
|
-
def self.yaml_new(klass, _, val)
|
9
|
-
klass.find(val['attributes']['_id'])
|
10
|
-
rescue Mongoid::Errors::DocumentNotFound
|
11
|
-
raise Delayed::DeserializationError
|
12
|
-
end
|
13
|
-
|
14
|
-
def to_yaml_properties
|
15
|
-
['@attributes']
|
16
|
-
end
|
17
|
-
end
|
18
|
-
else
|
19
|
-
Mongoid::Document.class_eval do
|
20
|
-
def encode_with(coder)
|
21
|
-
coder['attributes'] = @attributes
|
22
|
-
coder.tag = ['!ruby/Mongoid', self.class.name].join(':')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
require 'delayed_job'
|
2
|
+
require 'mongoid'
|
3
|
+
|
4
|
+
if YAML.parser.class.name =~ /syck/i
|
5
|
+
Mongoid::Document.class_eval do
|
6
|
+
yaml_as 'tag:ruby.yaml.org,2002:Mongoid'
|
7
|
+
|
8
|
+
def self.yaml_new(klass, _, val)
|
9
|
+
klass.find(val['attributes']['_id'])
|
10
|
+
rescue Mongoid::Errors::DocumentNotFound
|
11
|
+
raise Delayed::DeserializationError
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_yaml_properties
|
15
|
+
['@attributes']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
else
|
19
|
+
Mongoid::Document.class_eval do
|
20
|
+
def encode_with(coder)
|
21
|
+
coder['attributes'] = @attributes
|
22
|
+
coder.tag = ['!ruby/Mongoid', self.class.name].join(':')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module Delayed
|
2
|
-
module PsychExt
|
3
|
-
class ToRuby < Psych::Visitors::ToRuby
|
4
|
-
# see https://github.com/collectiveidea/delayed_job_mongoid/pull/65
|
5
|
-
alias _visit_Psych_Nodes_Mapping visit_Psych_Nodes_Mapping
|
6
|
-
|
7
|
-
def visit_Psych_Nodes_Mapping(object) # rubocop:disable MethodName
|
8
|
-
document = _visit_Psych_Nodes_Mapping(object)
|
9
|
-
register(object, document) if document
|
10
|
-
document
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
module Delayed
|
2
|
+
module PsychExt
|
3
|
+
class ToRuby < Psych::Visitors::ToRuby
|
4
|
+
# see https://github.com/collectiveidea/delayed_job_mongoid/pull/65
|
5
|
+
alias _visit_Psych_Nodes_Mapping visit_Psych_Nodes_Mapping
|
6
|
+
|
7
|
+
def visit_Psych_Nodes_Mapping(object) # rubocop:disable MethodName
|
8
|
+
document = _visit_Psych_Nodes_Mapping(object)
|
9
|
+
register(object, document) if document
|
10
|
+
document
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
require File.expand_path('psych_ext', __dir__) unless YAML.parser.class.name =~ /syck|yecht/i
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
require File.expand_path('psych_ext', __dir__) unless YAML.parser.class.name =~ /syck|yecht/i
|
data/lib/delayed_job_mongoid.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
require 'delayed/backend/mongoid'
|
2
|
-
require 'delayed/serialization/mongoid'
|
3
|
-
require 'delayed_job'
|
4
|
-
require 'delayed/
|
5
|
-
|
6
|
-
|
7
|
-
Delayed::Worker.backend = :mongoid
|
1
|
+
require 'delayed/backend/mongoid'
|
2
|
+
require 'delayed/serialization/mongoid'
|
3
|
+
require 'delayed_job'
|
4
|
+
require 'delayed/yaml/yaml_ext'
|
5
|
+
|
6
|
+
Delayed::Worker.backend = :mongoid
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Gaffney
|
@@ -10,9 +10,10 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
+
name: delayed_job
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
18
|
requirements:
|
18
19
|
- - ">="
|
@@ -21,9 +22,8 @@ dependencies:
|
|
21
22
|
- - "<"
|
22
23
|
- !ruby/object:Gem::Version
|
23
24
|
version: '5'
|
24
|
-
name: delayed_job
|
25
|
-
prerelease: false
|
26
25
|
type: :runtime
|
26
|
+
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
@@ -33,39 +33,19 @@ dependencies:
|
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '5'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.0'
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '8'
|
44
36
|
name: mongoid
|
45
|
-
prerelease: false
|
46
|
-
type: :runtime
|
47
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
-
requirements:
|
49
|
-
- - ">="
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: '3.0'
|
52
|
-
- - "<"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '8'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
37
|
requirement: !ruby/object:Gem::Requirement
|
57
38
|
requirements:
|
58
39
|
- - ">="
|
59
40
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
61
|
-
name: mongoid-compatibility
|
62
|
-
prerelease: false
|
41
|
+
version: '5.0'
|
63
42
|
type: :runtime
|
43
|
+
prerelease: false
|
64
44
|
version_requirements: !ruby/object:Gem::Requirement
|
65
45
|
requirements:
|
66
46
|
- - ">="
|
67
47
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
48
|
+
version: '5.0'
|
69
49
|
description:
|
70
50
|
email:
|
71
51
|
- chris@collectiveidea.com
|
@@ -81,7 +61,6 @@ files:
|
|
81
61
|
- README.md
|
82
62
|
- delayed_job_mongoid.gemspec
|
83
63
|
- lib/delayed/backend/mongoid.rb
|
84
|
-
- lib/delayed/plugins.rb
|
85
64
|
- lib/delayed/serialization/mongoid.rb
|
86
65
|
- lib/delayed/yaml/psych_ext.rb
|
87
66
|
- lib/delayed/yaml/yaml_ext.rb
|
@@ -105,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
84
|
- !ruby/object:Gem::Version
|
106
85
|
version: '0'
|
107
86
|
requirements: []
|
108
|
-
|
109
|
-
rubygems_version: 2.7.6
|
87
|
+
rubygems_version: 3.1.2
|
110
88
|
signing_key:
|
111
89
|
specification_version: 4
|
112
90
|
summary: Mongoid backend for delayed_job
|
data/lib/delayed/plugins.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# clear Mongoid::IdentityMap before each job
|
3
|
-
#
|
4
|
-
|
5
|
-
if ::Mongoid::Compatibility::Version.mongoid3?
|
6
|
-
module Delayed
|
7
|
-
module Plugins
|
8
|
-
class ClearIdentityMap < Plugin
|
9
|
-
callbacks do |lifecycle|
|
10
|
-
lifecycle.before(:invoke_job) do
|
11
|
-
Mongoid::IdentityMap.clear
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Delayed::Worker.plugins << Delayed::Plugins::ClearIdentityMap
|
19
|
-
end
|