Sha256: bf93090c3168db3c90b245d27193047f012f818445c6e4be161882378034e937

Contents?: true

Size: 847 Bytes

Versions: 14

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

require "shopify_cli/thread_pool"

require_relative "remote_watcher/json_files_update_job"

module ShopifyCLI
  module Theme
    class DevServer
      class RemoteWatcher
        SYNC_INTERVAL = 3 # seconds

        class << self
          def to(theme:, syncer:)
            new(theme, syncer)
          end
        end

        def start
          thread_pool.schedule(recurring_job)
        end

        def stop
          thread_pool.shutdown
        end

        private

        def initialize(theme, syncer)
          @theme = theme
          @syncer = syncer
        end

        def thread_pool
          @thread_pool ||= ShopifyCLI::ThreadPool.new(pool_size: 1)
        end

        def recurring_job
          JsonFilesUpdateJob.new(@theme, @syncer, SYNC_INTERVAL)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shopify-cli-2.36.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.35.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.34.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.33.1 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.33.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.32.1 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.32.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.31.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.30.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.29.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.28.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.27.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.26.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb
shopify-cli-2.25.0 lib/shopify_cli/theme/dev_server/remote_watcher.rb