Module HTM::JobAdapter ¶
| Defined in | lib/htm/job_adapter.rb |
Job adapter for pluggable background job backends
Supports multiple job backends to work seamlessly across different application types (CLI, Sinatra, Rails).
Supported backends: * :active_job - Rails ActiveJob (recommended for Rails apps) * :sidekiq - Direct Sidekiq integration (recommended for Sinatra apps) * :inline - Synchronous execution (recommended for CLI and tests) * :thread - Background thread (legacy, for standalone apps) * :fiber - Fiber-based concurrency using async gem (recommended for I/O-bound jobs)
@seeADR-016:Async Embedding and Tag Generation
@example Configure job backend
@example Enqueue a job
Public Class Methods¶
enqueue(job_class, **params) ¶
Enqueue a background job using the configured backend
- @param job_class [Class] Job class to enqueue (must respond to :perform)
- @param params [Hash] Parameters to pass to the job
- @raise [HTM::Error] If job backend is unknown
- @return [void]
enqueue_parallel(jobs) ¶
Execute multiple jobs in parallel using fibers Best for I/O-bound jobs like
LLM API calls
- @param jobs [Array@return [void]
@example Run embedding and tags jobs in parallel