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
DrMark-thinking-sphinx-1.1.14 lib/thinking_sphinx/deltas/delayed_delta/job.rb
DrMark-thinking-sphinx-1.1.15 lib/thinking_sphinx/deltas/delayed_delta/job.rb
DrMark-thinking-sphinx-1.1.6 lib/thinking_sphinx/deltas/delayed_delta/job.rb
DrMark-thinking-sphinx-1.2.5 lib/thinking_sphinx/deltas/delayed_delta/job.rb
DrMark-thinking-sphinx-1.2.6 lib/thinking_sphinx/deltas/delayed_delta/job.rb
bterlson-thinking-sphinx-1.2.8 lib/thinking_sphinx/deltas/delayed_delta/job.rb
dpickett-thinking-sphinx-1.1.12 lib/thinking_sphinx/deltas/delayed_delta/job.rb
dpickett-thinking-sphinx-1.1.23 lib/thinking_sphinx/deltas/delayed_delta/job.rb
dpickett-thinking-sphinx-1.1.4 lib/thinking_sphinx/deltas/delayed_delta/job.rb
ebeigarts-thinking-sphinx-1.1.21 lib/thinking_sphinx/deltas/delayed_delta/job.rb
ebeigarts-thinking-sphinx-1.1.22 lib/thinking_sphinx/deltas/delayed_delta/job.rb
ebeigarts-thinking-sphinx-1.2.10 lib/thinking_sphinx/deltas/delayed_delta/job.rb
factorylabs-thinking-sphinx-1.2.7 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.1 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.10 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.11 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.12 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.14 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.15 lib/thinking_sphinx/deltas/delayed_delta/job.rb
freelancing-god-thinking-sphinx-1.1.16 lib/thinking_sphinx/deltas/delayed_delta/job.rb