Sha256: 84f7b5e9eaef7bb1db48012822135a1f4acca2ac95dd51e6b58ae77623b151c0

Contents?: true

Size: 715 Bytes

Versions: 18

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true

require "datadog/core/worker"
require "datadog/core/workers/async"

# general purpose async worker for CI
# executes given task once in separate thread
module Datadog
  module CI
    class Worker < Datadog::Core::Worker
      include Datadog::Core::Workers::Async::Thread

      DEFAULT_SHUTDOWN_TIMEOUT = 60
      DEFAULT_WAIT_TIMEOUT = 60

      def stop(timeout = DEFAULT_SHUTDOWN_TIMEOUT)
        join(timeout)
      end

      def wait_until_done(timeout = DEFAULT_WAIT_TIMEOUT)
        join(timeout)
      end

      def done?
        started? && !running?
      end
    end

    class DummyWorker < Worker
      def initialize
        super { nil }
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
datadog-ci-1.11.0 lib/datadog/ci/worker.rb
datadog-ci-1.10.0 lib/datadog/ci/worker.rb
datadog-ci-1.9.0 lib/datadog/ci/worker.rb
datadog-ci-1.8.1 lib/datadog/ci/worker.rb
datadog-ci-1.8.0 lib/datadog/ci/worker.rb
datadog-ci-1.7.0 lib/datadog/ci/worker.rb
datadog-ci-1.6.0 lib/datadog/ci/worker.rb
datadog-ci-1.5.0 lib/datadog/ci/worker.rb
datadog-ci-1.4.1 lib/datadog/ci/worker.rb
datadog-ci-1.4.0 lib/datadog/ci/worker.rb
datadog-ci-1.3.0 lib/datadog/ci/worker.rb
datadog-ci-1.2.0 lib/datadog/ci/worker.rb
datadog-ci-1.1.0 lib/datadog/ci/worker.rb
datadog-ci-1.0.1 lib/datadog/ci/worker.rb
datadog-ci-1.0.0 lib/datadog/ci/worker.rb
datadog-ci-1.0.0.beta6 lib/datadog/ci/worker.rb
datadog-ci-1.0.0.beta3 lib/datadog/ci/worker.rb
datadog-ci-1.0.0.beta2 lib/datadog/ci/worker.rb