module Chore
  module Strategy
    class SingleWorkerStrategy
      def initialize(manager)
        @manager = manager
        @worker = nil
      end

      def start;end
      def stop!;end

      def assign(work)
        if workers_available?
          @worker = Worker.new(work)
          @worker.start
          @worker = nil
          true
        end
      end

      def workers_available?
        @worker.nil?
      end
    end
  end
end

module Chore
  module Strategy
    class SingleWorkerStrategy

      attr_reader :worker

      def initialize(manager)
        @manager = manager
        @worker = nil
      end

      def start;end
      def stop!
        worker.stop! if worker
      end

      def assign(work)
        if workers_available?
          @worker = Worker.new(work)
          @worker.start
          @worker = nil
          true
        end
      end

      def workers_available?
        @worker.nil?
      end
    end
  end
end

Fix the case where ThreadedConsumerStrategy with a SingleWorkerStrategy with a large batch does not properly shut down when the Chore::Manager shuts down
Fix the case where ThreadedConsumerStrategy with a SingleWorkerStrategy with a large batch does not properly shut down when the Chore::Manager shuts down
