ts-delayed-delta 2.0.2 → 2.1.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b31149b4ef77b3adb6144930576938e42b6c399bae4712406920916bb2ed0cae
|
4
|
+
data.tar.gz: d0b62489cd29b17ecba58f34d28383861ebabdf342d6a11442b53900ecaf52c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe790bca28f2864dedd29c8ef9335d34a5b364adefbf429122e91ecc885c007cd7c86fb5b33cc5a5bf381a8dea80013b3b2fe6d62656ecf10a5a91ebe4a6bc7
|
7
|
+
data.tar.gz: 8058360c4d89f0e302d4eeeb992fa0e6bcdd78d19e294a03fc3ec6bf72a2371c1bf652f9f8e399bb8aaf6d17f4cefb3aacbfc47ee686fb723b01b524e5735785
|
data/README.textile
CHANGED
@@ -6,7 +6,7 @@ This version works with Thinking Sphinx v1.5.0, v2.1.0 and v3.x.
|
|
6
6
|
|
7
7
|
In your @Gemfile@, it'll likely look something like this:
|
8
8
|
|
9
|
-
<pre><code>gem 'ts-delayed-delta', '~> 2.
|
9
|
+
<pre><code>gem 'ts-delayed-delta', '~> 2.1'</code></pre>
|
10
10
|
|
11
11
|
Or, if you're referring directly to the git repository:
|
12
12
|
|
@@ -64,7 +64,9 @@ h2. Contributors
|
|
64
64
|
* "Georg Ledermann":http://www.georg-ledermann.de (DJ 2.0.x backwards compatibility)
|
65
65
|
* "Jonathan Lim":http://snowblink.co.uk (Cleaning up version references)
|
66
66
|
* "Manjunath Manohar":https://github.com/manjunath-nm89 (Allow setting of job queue, smarter cleaning up of jobs)
|
67
|
+
* "Mikko Koski":https://github.com/rap1ds (Ensure new jobs are created if all existing jobs are failures)
|
68
|
+
* "Jason Barnabe":https://github.com/JasonBarnabe (Fix Rails 5.x compatibility)
|
67
69
|
|
68
70
|
h2. Copyright
|
69
71
|
|
70
|
-
Copyright (c) 2009-
|
72
|
+
Copyright (c) 2009-2018, Thinking Sphinx Delayed Deltas (ts-delayed-delta) is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/ts-delayed-delta/contributors.
|
@@ -15,19 +15,26 @@ class ThinkingSphinx::Deltas::DelayedDelta <
|
|
15
15
|
ThinkingSphinx::Deltas::DefaultDelta
|
16
16
|
|
17
17
|
def self.cancel_jobs
|
18
|
-
|
18
|
+
where_clause = [
|
19
19
|
"handler LIKE (?) AND locked_at IS NULL AND locked_by IS NULL AND failed_at IS NULL", "--- !ruby/object:ThinkingSphinx::Deltas::%"
|
20
|
-
]
|
20
|
+
]
|
21
|
+
if Delayed::Job.respond_to?(:where)
|
22
|
+
# Supported in Rails 3 and up.
|
23
|
+
Delayed::Job.where(where_clause).delete_all
|
24
|
+
else
|
25
|
+
# Supported from Rails 2, deprecated in Rails 5.
|
26
|
+
Delayed::Job.delete_all(where_clause)
|
27
|
+
end
|
21
28
|
end
|
22
29
|
|
23
30
|
def self.enqueue_unless_duplicates(object)
|
24
31
|
if Delayed::Job.respond_to?(:where)
|
25
32
|
return if Delayed::Job.where(
|
26
|
-
:handler => object.to_yaml, :locked_at => nil
|
33
|
+
:handler => object.to_yaml, :locked_at => nil, :failed_at => nil
|
27
34
|
).count > 0
|
28
35
|
else
|
29
36
|
return if Delayed::Job.count(
|
30
|
-
:conditions => {:handler => object.to_yaml, :locked_at => nil}
|
37
|
+
:conditions => {:handler => object.to_yaml, :locked_at => nil, :failed_at => nil}
|
31
38
|
) > 0
|
32
39
|
end
|
33
40
|
|
@@ -84,7 +91,8 @@ class ThinkingSphinx::Deltas::DelayedDelta <
|
|
84
91
|
|
85
92
|
Delayed::Job.enqueue(
|
86
93
|
ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob.new(
|
87
|
-
model.core_index_names, instance.sphinx_document_id
|
94
|
+
model.core_index_names, instance.sphinx_document_id,
|
95
|
+
instance.class.name, instance.id
|
88
96
|
), self.class.job_options
|
89
97
|
) if instance
|
90
98
|
|
@@ -108,9 +116,11 @@ class ThinkingSphinx::Deltas::DelayedDelta <
|
|
108
116
|
|
109
117
|
module SphinxQL
|
110
118
|
def delete(index, instance)
|
119
|
+
id = instance.send(index.options[:primary_key] || :id)
|
111
120
|
Delayed::Job.enqueue(
|
112
121
|
ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob.new(
|
113
|
-
index.name, index.document_id_for_key(
|
122
|
+
index.name, index.document_id_for_key(id),
|
123
|
+
instance.class.name, id
|
114
124
|
), self.class.job_options
|
115
125
|
)
|
116
126
|
end
|
@@ -9,8 +9,9 @@ class ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob
|
|
9
9
|
# @param [String] index The index name
|
10
10
|
# @param [Integer] document_id The document id
|
11
11
|
#
|
12
|
-
def initialize(index, document_id)
|
13
|
-
@index, @document_id
|
12
|
+
def initialize(index, document_id, instance_type, instance_id)
|
13
|
+
@index, @document_id, @instance_type, @instance_id =
|
14
|
+
index, document_id, instance_type, instance_id
|
14
15
|
end
|
15
16
|
|
16
17
|
def display_name
|
@@ -24,6 +25,18 @@ class ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob
|
|
24
25
|
# and just use the new values in the delta index as a reference point.
|
25
26
|
#
|
26
27
|
def perform
|
27
|
-
|
28
|
+
return unless instance.nil? || instance.delta?
|
29
|
+
|
30
|
+
ThinkingSphinx::Deltas::DeleteJob.new(index, document_id).perform
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :index, :document_id, :instance_type, :instance_id
|
36
|
+
|
37
|
+
def instance
|
38
|
+
@instance ||= instance_type.constantize.find instance_id
|
39
|
+
rescue ActiveRecord::RecordNotFound
|
40
|
+
nil
|
28
41
|
end
|
29
42
|
end
|
data/ts-delayed-delta.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'ts-delayed-delta'
|
6
|
-
s.version = '2.0
|
6
|
+
s.version = '2.1.0'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ['Pat Allan']
|
9
9
|
s.email = ['pat@freelancing-gods.com']
|
@@ -22,13 +22,14 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_runtime_dependency 'thinking-sphinx', '>= 1.5.0'
|
24
24
|
s.add_runtime_dependency 'delayed_job'
|
25
|
+
s.add_runtime_dependency 'activerecord', '>= 2.0'
|
25
26
|
|
26
27
|
s.add_development_dependency 'appraisal', '~> 0.5.2'
|
27
28
|
s.add_development_dependency 'combustion', '~> 0.4.0'
|
28
29
|
s.add_development_dependency 'database_cleaner', '~> 0.7.1'
|
29
30
|
s.add_development_dependency 'delayed_job_active_record', '~> 0.4.4'
|
30
|
-
s.add_development_dependency 'mysql2', '~> 0.3.
|
31
|
+
s.add_development_dependency 'mysql2', '~> 0.3.18'
|
31
32
|
s.add_development_dependency 'pg', '~> 0.11.0'
|
32
|
-
s.add_development_dependency 'rake', '
|
33
|
-
s.add_development_dependency 'rspec', '~> 2.11
|
33
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
34
|
+
s.add_development_dependency 'rspec', '~> 2.11'
|
34
35
|
end
|
metadata
CHANGED
@@ -1,155 +1,169 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ts-delayed-delta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thinking-sphinx
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: delayed_job
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activerecord
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: appraisal
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - ~>
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: 0.5.2
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - ~>
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: 0.5.2
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: combustion
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: 0.4.0
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: 0.4.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: database_cleaner
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - ~>
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: 0.7.1
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - ~>
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: 0.7.1
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: delayed_job_active_record
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - ~>
|
101
|
+
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: 0.4.4
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - ~>
|
108
|
+
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: 0.4.4
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: mysql2
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - ~>
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.3.
|
117
|
+
version: 0.3.18
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - ~>
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.3.
|
124
|
+
version: 0.3.18
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: pg
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - ~>
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: 0.11.0
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - ~>
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: 0.11.0
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rake
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- -
|
143
|
+
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0
|
145
|
+
version: '10.0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- -
|
150
|
+
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0
|
152
|
+
version: '10.0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rspec
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- - ~>
|
157
|
+
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.11
|
159
|
+
version: '2.11'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- - ~>
|
164
|
+
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.11
|
166
|
+
version: '2.11'
|
153
167
|
description: Manage delta indexes via Delayed Job for Thinking Sphinx
|
154
168
|
email:
|
155
169
|
- pat@freelancing-gods.com
|
@@ -157,8 +171,8 @@ executables: []
|
|
157
171
|
extensions: []
|
158
172
|
extra_rdoc_files: []
|
159
173
|
files:
|
160
|
-
- .gitignore
|
161
|
-
- .travis.yml
|
174
|
+
- ".gitignore"
|
175
|
+
- ".travis.yml"
|
162
176
|
- Appraisals
|
163
177
|
- Gemfile
|
164
178
|
- LICENSE
|
@@ -193,17 +207,17 @@ require_paths:
|
|
193
207
|
- lib
|
194
208
|
required_ruby_version: !ruby/object:Gem::Requirement
|
195
209
|
requirements:
|
196
|
-
- -
|
210
|
+
- - ">="
|
197
211
|
- !ruby/object:Gem::Version
|
198
212
|
version: '0'
|
199
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
214
|
requirements:
|
201
|
-
- -
|
215
|
+
- - ">="
|
202
216
|
- !ruby/object:Gem::Version
|
203
217
|
version: '0'
|
204
218
|
requirements: []
|
205
219
|
rubyforge_project: ts-delayed-delta
|
206
|
-
rubygems_version: 2.
|
220
|
+
rubygems_version: 2.7.6
|
207
221
|
signing_key:
|
208
222
|
specification_version: 4
|
209
223
|
summary: Thinking Sphinx - Delayed Deltas
|