Class: EmbeddingBatchQueueWorker
- Inherits:
-
Object
- Object
- EmbeddingBatchQueueWorker
- Includes:
- Sidekiq::Job, Workers::StatusBroadcastable
- Defined in:
- app/workers/embedding_batch_queue_worker.rb
Overview
Background worker that queues embedding jobs in batches.
This avoids timeout issues when queueing large numbers of records from the web UI.
Instance Attribute Summary
Attributes included from Workers::StatusBroadcastable
Instance Method Summary collapse
Methods included from Workers::StatusBroadcastable::Overrides
Instance Method Details
#perform(type, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/workers/embedding_batch_queue_worker.rb', line 23 def perform(type, = {}) store started_at: Time.current.iso8601 store type: type count = case type when 'Post' then queue_posts when 'Article' then queue_articles([:article_type]) when 'Showcase' then queue_showcases when 'Video' then queue_videos when 'Image' then queue_images when 'SiteMap' then queue_sitemaps when 'ReviewsIo' then queue_reviews when 'Item' then queue_items when 'CallRecord' then queue_call_records when 'ProductLine' then queue_product_lines when 'Activity' then queue_activities when 'Communication' then queue_communications when 'AssistantBrainEntry' then queue_brain_entries when 'ImageFingerprints' then queue_image_fingerprints else store error: "Unknown type: #{type}" 0 end store completed_at: Time.current.iso8601 store queued_count: count Rails.logger.info "[EmbeddingBatchQueueWorker] Queued #{count} #{type} records" end |