Sha256: 3ac0297873a4aa26ab51cfe034d96ccc6706875e083a61675739616b1f6cc8c3

Contents?: true

Size: 602 Bytes

Versions: 69

Compression:

Stored size: 602 Bytes

Contents

module ThinkingSphinx
  module Deltas
    class Job < Delayed::Job
      def self.enqueue(object, priority = 0)
        super unless duplicates_exist(object)
      end
      
      def self.cancel_thinking_sphinx_jobs
        if connection.tables.include?("delayed_jobs")
          delete_all("handler LIKE '--- !ruby/object:ThinkingSphinx::Deltas::%'")
        end
      end

      private

      def self.duplicates_exist(object)
        count(
          :conditions => {
            :handler    => object.to_yaml,
            :locked_at  => nil
          }
        ) > 0
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 15 rubygems

Version Path
sherpa99-thinking-sphinx-1.1.4 lib/thinking_sphinx/deltas/delayed_delta/job.rb
thinking-sphinx-099-1.2.13 lib/thinking_sphinx/deltas/delayed_delta/job.rb
thinking-sphinx-1.2.13 lib/thinking_sphinx/deltas/delayed_delta/job.rb
moneypools-thinking-sphinx-1.2.13 lib/thinking_sphinx/deltas/delayed_delta/job.rb
moneypools-thinking-sphinx-1.2.12 lib/thinking_sphinx/deltas/delayed_delta/job.rb
moneypools-thinking-sphinx-1.2.11 lib/thinking_sphinx/deltas/delayed_delta/job.rb
warp-thinking-sphinx-1.2.12 lib/thinking_sphinx/deltas/delayed_delta/job.rb
thinking-sphinx-099-1.2.12 lib/thinking_sphinx/deltas/delayed_delta/job.rb
thinking-sphinx-1.2.12 lib/thinking_sphinx/deltas/delayed_delta/job.rb