Class: Joblin::BackgroundTask
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Joblin::BackgroundTask
- Includes:
- ApiAccess, Attachments, Executor, Options, RetentionPolicy
- Defined in:
- app/models/joblin/background_task.rb,
app/models/joblin/background_task/options.rb,
app/models/joblin/background_task/executor.rb,
app/models/joblin/background_task/api_access.rb,
app/models/joblin/background_task/attachments.rb,
app/models/joblin/background_task/retention_policy.rb
Defined Under Namespace
Modules: ApiAccess, Attachments, Executor, Options, RetentionPolicy Classes: BackgroundTaskCallbacks, InvalidJobError
Constant Summary
Constants included from Executor
Executor::BACKGROUND_TASK_THREAD_KEY
Instance Method Summary collapse
Methods included from ApiAccess
Methods included from Attachments
#attach_file, #attachment_path, #load_attachment
Methods included from Concerns::JobWorkingDirs
Methods included from Options
Instance Method Details
#cancel! ⇒ Object
37 38 39 |
# File 'app/models/joblin/background_task.rb', line 37 def cancel! update!(workflow_state: 'cancelled') end |
#enqueue! ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/models/joblin/background_task.rb', line 29 def enqueue! self.workflow_state = 'scheduled' if self.workflow_state == 'unscheduled' enter_batch do self.class::ExecutorJob.perform_later() end end |
#handle_batch_stagnation ⇒ Object
41 42 43 |
# File 'app/models/joblin/background_task.rb', line 41 def handle_batch_stagnation Joblin::Batching::Batch.cleanup_redis(batch_id) end |