Class: Langsmith::FlushBufferJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- Langsmith::FlushBufferJob
- Defined in:
- lib/generators/langsmithrb_rails/buffer/templates/flush_buffer_job.rb
Overview
Job for flushing the LangSmith buffer
Constant Summary collapse
- BATCH_SIZE =
Maximum number of traces to process in a single job
100
Instance Method Summary collapse
-
#perform(retry_failed: false) ⇒ Object
Process the job.
Instance Method Details
#perform(retry_failed: false) ⇒ Object
Process the job
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/generators/langsmithrb_rails/buffer/templates/flush_buffer_job.rb', line 13 def perform(retry_failed: false) # Get pending traces traces = LangsmithRunBuffer.pending.limit(BATCH_SIZE) process_traces(traces) # Get failed traces if requested if retry_failed traces = LangsmithRunBuffer.ready_to_retry.limit(BATCH_SIZE) process_traces(traces) end end |