Skip to content
Browse files

added pry

  • Loading branch information...
1 parent 4f155f6 commit f124014ce438504009144bef028851df5bcf7f2c Danny committed May 22, 2012
View
3 Gemfile
@@ -3,7 +3,10 @@ source "http://rubygems.org"
# Specify your gem's dependencies in ts-resque-delta.gemspec
gemspec
+gem 'pry'
+
group :development do
+
if RUBY_PLATFORM =~ /darwin/i
gem 'rb-fsevent'
gem 'ruby_gntp'
View
19 lib/thinking_sphinx/deltas/sidekiq_delta/flag_as_deleted_set.rb
@@ -15,16 +15,17 @@ def processing_name(core_name)
end
def add(core_name, document_id)
- Sidkiq.redis{|r| r.sadd(set_name(core_name), document_id) }
+ binding.pry
+ Sidekiq.redis{|r| r.sadd(set_name(core_name), document_id) }
end
def clear!(core_name)
- Sidkiq.redis{|r| r.del(set_name(core_name)) }
+ Sidekiq.redis{|r| r.del(set_name(core_name)) }
#Clear processing set as well
delta_name = ThinkingSphinx::Deltas::SidekiqDelta::IndexUtils.core_to_delta(core_name)
ThinkingSphinx::Deltas::SidekiqDelta::DeltaJob.around_perform_lock(delta_name) do
- Resque.redis.del(processing_name(core_name))
+ Sidekiq.redis{|r| r.del(processing_name(core_name)) }
end
end
@@ -36,21 +37,21 @@ def clear_all!
def get_subset_for_processing(core_name)
# Copy set to temp
- Resque.redis.sunionstore temp_name(core_name), set_name(core_name)
+ Sidekiq.redis{|r| r.sunionstore temp_name(core_name), set_name(core_name) }
# Store (set - temp) into set. This removes all items we copied into temp from set.
- Resque.redis.sdiffstore set_name(core_name), set_name(core_name), temp_name(core_name)
+ Sidekiq.redis{|r| r.sdiffstore set_name(core_name), set_name(core_name), temp_name(core_name) }
# Merge processing and temp together and store into processing.
- Resque.redis.sunionstore processing_name(core_name), processing_name(core_name), temp_name(core_name)
+ Sidekiq.redis{|r| r.sunionstore processing_name(core_name), processing_name(core_name), temp_name(core_name) }
- Resque.redis.del temp_name(core_name)
+ Sidekiq.redis{|r| r.del temp_name(core_name) }
end
def processing_members(core_name)
- Resque.redis.smembers(processing_name(core_name)).collect(&:to_i)
+ Sidekiq.redis{|r| r.smembers(processing_name(core_name)).collect(&:to_i) }
end
def clear_processing(core_name)
- Resque.redis.del(processing_name(core_name))
+ Sidekiq.redis{|r| r.del(processing_name(core_name)) }
end
end
end
View
5 spec/thinking_sphinx/deltas/sidekiq_delta/flag_as_deleted_set_spec.rb
@@ -3,11 +3,12 @@
describe ThinkingSphinx::Deltas::SidekiqDelta::FlagAsDeletedSet do
describe '.add' do
before :each do
- Resque.stub_chain(:redis, :sadd => true)
+ #Resque.stub_chain(:redis, :sadd => true)
+ Sidekiq.should_receive(:redis){ |r| r.stub(:sadd).and_return(true) }
end
it 'should add the document id to the correct set' do
- Resque.redis.should_receive(:sadd).once.with(subject.set_name('foo_core'), 42)
+ Sidekiq.should_receive(:redis) {|r| r.should_receive(:sadd).with(subject.set_name('foo_core'), 42) }
subject.add('foo_core', 42)
end
end
View
4 spec/thinking_sphinx/deltas/sidekiq_delta_spec.rb
@@ -5,7 +5,7 @@
ThinkingSphinx.updates_enabled = true
ThinkingSphinx.deltas_enabled = true
- Sidekiq.redis = MockRedis.new
+ Sidekiq.redis = { url: "resque://localhost:6379/", namespace: 'test' }
end
describe '#index' do
@@ -40,7 +40,7 @@ def flag_as_deleted_document_in_set?
end
before :each do
- Resque.stub(:enqueue => true)
+ ThinkingSphinx::Deltas::SidekiqDelta::DeltaJob.stub(:perform_async => true)
end
context 'updates disabled' do

0 comments on commit f124014

Please sign in to comment.
Something went wrong with that request. Please try again.