promiscuous 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,9 @@ module Promiscuous::Publisher::Mongoid::Defer
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
mattr_accessor :klasses
|
5
|
+
mattr_accessor :collections
|
5
6
|
self.klasses = {}
|
7
|
+
self.collections = {}
|
6
8
|
|
7
9
|
def publish
|
8
10
|
super unless should_defer?
|
@@ -23,8 +25,8 @@ module Promiscuous::Publisher::Mongoid::Defer
|
|
23
25
|
Moped::Query.class_eval do
|
24
26
|
alias_method :update_orig, :update
|
25
27
|
def update(change, flags = nil)
|
26
|
-
if
|
27
|
-
psp_field =
|
28
|
+
if Promiscuous::Publisher::Mongoid::Defer.collections[@collection.name]
|
29
|
+
psp_field = :_psp
|
28
30
|
change = change.dup
|
29
31
|
change['$set'] ||= {}
|
30
32
|
change['$set'].merge!(psp_field => true)
|
@@ -41,12 +43,12 @@ module Promiscuous::Publisher::Mongoid::Defer
|
|
41
43
|
self.publisher_defer_hooked = true
|
42
44
|
|
43
45
|
# TODO Make sure we are not overriding a field, although VERY unlikly
|
44
|
-
|
45
|
-
|
46
|
-
index({psp_field => 1}, :background => true, :sparse => true)
|
46
|
+
field :_psp, :type => Boolean
|
47
|
+
index({:_psp => 1}, :background => true, :sparse => true)
|
47
48
|
|
48
49
|
Promiscuous::Publisher::Mongoid::Defer.hook_mongoid
|
49
|
-
Promiscuous::Publisher::Mongoid::Defer.klasses[
|
50
|
+
Promiscuous::Publisher::Mongoid::Defer.klasses[self.to_s] = self
|
51
|
+
Promiscuous::Publisher::Mongoid::Defer.collections[collection.name] = true
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -42,8 +42,7 @@ class Promiscuous::Publisher::Worker
|
|
42
42
|
def replicate_collection(klass)
|
43
43
|
return if self.stop
|
44
44
|
# TODO Check for indexes and if not there, bail out
|
45
|
-
|
46
|
-
while instance = klass.where(psp_field => true).find_and_modify({'$unset' => {psp_field => 1}})
|
45
|
+
while instance = klass.where(:_psp => true).find_and_modify({'$unset' => {:_psp => 1}})
|
47
46
|
replicate_instance(instance)
|
48
47
|
end
|
49
48
|
end
|
data/lib/promiscuous/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promiscuous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -103,65 +103,65 @@ files:
|
|
103
103
|
- lib/promiscuous/amqp/bunny.rb
|
104
104
|
- lib/promiscuous/amqp/null.rb
|
105
105
|
- lib/promiscuous/amqp/rubyamqp.rb
|
106
|
-
- lib/promiscuous/
|
107
|
-
- lib/promiscuous/
|
108
|
-
- lib/promiscuous/
|
109
|
-
- lib/promiscuous/
|
106
|
+
- lib/promiscuous/amqp.rb
|
107
|
+
- lib/promiscuous/common/class_helpers.rb
|
108
|
+
- lib/promiscuous/common/lint/base.rb
|
109
|
+
- lib/promiscuous/common/lint.rb
|
110
|
+
- lib/promiscuous/common/options.rb
|
111
|
+
- lib/promiscuous/common/worker.rb
|
112
|
+
- lib/promiscuous/common.rb
|
113
|
+
- lib/promiscuous/config.rb
|
114
|
+
- lib/promiscuous/ephemeral.rb
|
115
|
+
- lib/promiscuous/loader.rb
|
116
|
+
- lib/promiscuous/observer.rb
|
110
117
|
- lib/promiscuous/publisher/active_record.rb
|
118
|
+
- lib/promiscuous/publisher/amqp.rb
|
111
119
|
- lib/promiscuous/publisher/attributes.rb
|
112
120
|
- lib/promiscuous/publisher/base.rb
|
113
|
-
- lib/promiscuous/publisher/
|
121
|
+
- lib/promiscuous/publisher/class.rb
|
122
|
+
- lib/promiscuous/publisher/envelope.rb
|
123
|
+
- lib/promiscuous/publisher/ephemeral.rb
|
124
|
+
- lib/promiscuous/publisher/error.rb
|
114
125
|
- lib/promiscuous/publisher/lint/amqp.rb
|
115
126
|
- lib/promiscuous/publisher/lint/attributes.rb
|
116
127
|
- lib/promiscuous/publisher/lint/base.rb
|
117
128
|
- lib/promiscuous/publisher/lint/class.rb
|
118
129
|
- lib/promiscuous/publisher/lint/polymorphic.rb
|
119
|
-
- lib/promiscuous/publisher/
|
120
|
-
- lib/promiscuous/publisher/class.rb
|
130
|
+
- lib/promiscuous/publisher/lint.rb
|
121
131
|
- lib/promiscuous/publisher/mock.rb
|
122
|
-
- lib/promiscuous/publisher/amqp.rb
|
123
|
-
- lib/promiscuous/publisher/error.rb
|
124
132
|
- lib/promiscuous/publisher/model.rb
|
125
|
-
- lib/promiscuous/publisher/
|
126
|
-
- lib/promiscuous/publisher/
|
133
|
+
- lib/promiscuous/publisher/mongoid/defer.rb
|
134
|
+
- lib/promiscuous/publisher/mongoid/defer_embedded.rb
|
135
|
+
- lib/promiscuous/publisher/mongoid/embedded.rb
|
127
136
|
- lib/promiscuous/publisher/mongoid.rb
|
137
|
+
- lib/promiscuous/publisher/polymorphic.rb
|
138
|
+
- lib/promiscuous/publisher/worker.rb
|
139
|
+
- lib/promiscuous/publisher.rb
|
128
140
|
- lib/promiscuous/railtie/replicate.rake
|
141
|
+
- lib/promiscuous/railtie.rb
|
142
|
+
- lib/promiscuous/subscriber/active_record.rb
|
143
|
+
- lib/promiscuous/subscriber/amqp.rb
|
144
|
+
- lib/promiscuous/subscriber/attributes.rb
|
145
|
+
- lib/promiscuous/subscriber/base.rb
|
146
|
+
- lib/promiscuous/subscriber/class.rb
|
129
147
|
- lib/promiscuous/subscriber/envelope.rb
|
130
148
|
- lib/promiscuous/subscriber/error.rb
|
131
|
-
- lib/promiscuous/subscriber/mongoid/embedded.rb
|
132
|
-
- lib/promiscuous/subscriber/active_record.rb
|
133
|
-
- lib/promiscuous/subscriber/lint.rb
|
134
149
|
- lib/promiscuous/subscriber/lint/amqp.rb
|
150
|
+
- lib/promiscuous/subscriber/lint/attributes.rb
|
135
151
|
- lib/promiscuous/subscriber/lint/base.rb
|
136
152
|
- lib/promiscuous/subscriber/lint/class.rb
|
137
153
|
- lib/promiscuous/subscriber/lint/polymorphic.rb
|
138
|
-
- lib/promiscuous/subscriber/lint
|
139
|
-
- lib/promiscuous/subscriber/base.rb
|
140
|
-
- lib/promiscuous/subscriber/mongoid.rb
|
141
|
-
- lib/promiscuous/subscriber/upsert.rb
|
154
|
+
- lib/promiscuous/subscriber/lint.rb
|
142
155
|
- lib/promiscuous/subscriber/model.rb
|
143
|
-
- lib/promiscuous/subscriber/
|
156
|
+
- lib/promiscuous/subscriber/mongoid/embedded.rb
|
157
|
+
- lib/promiscuous/subscriber/mongoid.rb
|
144
158
|
- lib/promiscuous/subscriber/observer.rb
|
145
|
-
- lib/promiscuous/subscriber/attributes.rb
|
146
|
-
- lib/promiscuous/subscriber/amqp.rb
|
147
159
|
- lib/promiscuous/subscriber/polymorphic.rb
|
160
|
+
- lib/promiscuous/subscriber/upsert.rb
|
148
161
|
- lib/promiscuous/subscriber/worker.rb
|
149
|
-
- lib/promiscuous/config.rb
|
150
|
-
- lib/promiscuous/amqp.rb
|
151
|
-
- lib/promiscuous/common/lint.rb
|
152
|
-
- lib/promiscuous/common/lint/base.rb
|
153
|
-
- lib/promiscuous/common/options.rb
|
154
|
-
- lib/promiscuous/common/class_helpers.rb
|
155
|
-
- lib/promiscuous/common/worker.rb
|
156
|
-
- lib/promiscuous/loader.rb
|
157
|
-
- lib/promiscuous/railtie.rb
|
158
|
-
- lib/promiscuous/observer.rb
|
159
|
-
- lib/promiscuous/common.rb
|
160
162
|
- lib/promiscuous/subscriber.rb
|
161
|
-
- lib/promiscuous/worker.rb
|
162
|
-
- lib/promiscuous/publisher.rb
|
163
|
-
- lib/promiscuous/ephemeral.rb
|
164
163
|
- lib/promiscuous/version.rb
|
164
|
+
- lib/promiscuous/worker.rb
|
165
165
|
- lib/promiscuous.rb
|
166
166
|
- README.md
|
167
167
|
homepage: http://github.com/crowdtap/promiscuous
|