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
freelancing-god-thinking-sphinx-1.2.2 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.3 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.4 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.5 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.6 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.7 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.8 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.2.9 lib/thinking_sphinx/deltas/delayed_delta/job.rb
hariton-thinking-sphinx-1.2.11.2 lib/thinking_sphinx/deltas/delayed_delta/job.rb
hariton-thinking-sphinx-1.2.11 lib/thinking_sphinx/deltas/delayed_delta/job.rb
hariton-thinking-sphinx-1.2.7.0 lib/thinking_sphinx/deltas/delayed_delta/job.rb
hariton-thinking-sphinx-1.2.7.1 lib/thinking_sphinx/deltas/delayed_delta/job.rb
initforthe-thinking-sphinx-1.1.21 lib/thinking_sphinx/deltas/delayed_delta/job.rb
lostboy-thinking-sphinx-1.1.5.1 lib/thinking_sphinx/deltas/delayed_delta/job.rb
lostboy-thinking-sphinx-1.1.5.2 lib/thinking_sphinx/deltas/delayed_delta/job.rb
lostboy-thinking-sphinx-1.1.5.3 lib/thinking_sphinx/deltas/delayed_delta/job.rb
lostboy-thinking-sphinx-1.1.5.4 lib/thinking_sphinx/deltas/delayed_delta/job.rb
lostboy-thinking-sphinx-1.1.5.5 lib/thinking_sphinx/deltas/delayed_delta/job.rb
pixeltrix-thinking-sphinx-1.1.5 lib/thinking_sphinx/deltas/delayed_delta/job.rb
pixeltrix-thinking-sphinx-1.2.1 lib/thinking_sphinx/deltas/delayed_delta/job.rb