master_slave_adapter_tcurdt 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -153,13 +153,26 @@ module ActiveRecord
|
|
153
153
|
|
154
154
|
def transaction(*args)
|
155
155
|
# puts "<transaction"
|
156
|
-
yield
|
156
|
+
result = yield
|
157
157
|
# puts "</transaction"
|
158
158
|
update_clock
|
159
|
+
result
|
159
160
|
end
|
160
161
|
|
161
162
|
class << self
|
162
163
|
|
164
|
+
def with_master(&block)
|
165
|
+
ActiveRecord::Base.with_master(&block)
|
166
|
+
end
|
167
|
+
|
168
|
+
def with_slave(&block)
|
169
|
+
ActiveRecord::Base.with_slave(&block)
|
170
|
+
end
|
171
|
+
|
172
|
+
def with_consitency(clock, &block)
|
173
|
+
ActiveRecord::Base.with_slave(clock, &block)
|
174
|
+
end
|
175
|
+
|
163
176
|
def reset!
|
164
177
|
Thread.current[:master_slave_connection] = nil
|
165
178
|
Thread.current[:master_slave_clock] = nil
|