polleverywhere/quebert

View on GitHub
lib/quebert/backend/sync.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Quebert
  module Backend
    # Run the job syncronously. This is typically used in a testing environment
    # or could be used as a fallback if other backends fail to initialize
    class Sync
      def put(job, *args)
        Controller::Base.new(Job.from_json(job.to_json)).perform
      end

      def reserve(*args, &block)
        # reserve doesn't do anything in sync mode
        @null_controller ||= Controller::NullController.new
      end
    end
  end
end