Class: Hackle::PollingWorkspaceFetcher
- Inherits:
-
Object
- Object
- Hackle::PollingWorkspaceFetcher
- Includes:
- WorkspaceFetcher
- Defined in:
- lib/hackle/internal/workspace/polling_workspace_fetcher.rb
Instance Method Summary collapse
- #fetch ⇒ Workspace?
-
#initialize(http_workspace_fetcher:, scheduler:, polling_interval_seconds:) ⇒ PollingWorkspaceFetcher
constructor
A new instance of PollingWorkspaceFetcher.
- #resume ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(http_workspace_fetcher:, scheduler:, polling_interval_seconds:) ⇒ PollingWorkspaceFetcher
Returns a new instance of PollingWorkspaceFetcher.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hackle/internal/workspace/polling_workspace_fetcher.rb', line 12 def initialize(http_workspace_fetcher:, scheduler:, polling_interval_seconds:) # @type [HttpWorkspaceFetcher] @http_workspace_fetcher = http_workspace_fetcher # @type [Scheduler] @scheduler = scheduler # @type [Float] @polling_interval_seconds = polling_interval_seconds # @type [ScheduledJob, nil] @polling_job = nil # @type [Workspace, nil] @workspace = nil end |
Instance Method Details
#fetch ⇒ Workspace?
30 31 32 |
# File 'lib/hackle/internal/workspace/polling_workspace_fetcher.rb', line 30 def fetch @workspace end |
#resume ⇒ Object
46 47 48 49 |
# File 'lib/hackle/internal/workspace/polling_workspace_fetcher.rb', line 46 def resume @polling_job&.cancel @polling_job = @scheduler.schedule_periodically(@polling_interval_seconds, -> { poll }) end |
#start ⇒ Object
34 35 36 37 38 39 |
# File 'lib/hackle/internal/workspace/polling_workspace_fetcher.rb', line 34 def start return unless @polling_job.nil? poll @polling_job = @scheduler.schedule_periodically(@polling_interval_seconds, -> { poll }) end |
#stop ⇒ Object
41 42 43 44 |
# File 'lib/hackle/internal/workspace/polling_workspace_fetcher.rb', line 41 def stop @polling_job&.cancel @polling_job = nil end |