Class: Events::Subscribers::DrainKickoff

Inherits:
Object
  • Object
show all
Includes:
Events::Subscriber
Defined in:
lib/events/subscribers/drain_kickoff.rb

Overview

Entry subscriber for the drain loop. On Events::StartProcessing, enqueues DrainJob — the actual work (session claim, PM promotion, LLM call) happens in the job so the emitter’s thread isn’t blocked.

Instance Method Summary collapse

Instance Method Details

#emit(event) ⇒ Object

Parameters:

  • event (Hash)

    Rails.event notification hash



12
13
14
15
16
17
# File 'lib/events/subscribers/drain_kickoff.rb', line 12

def emit(event)
  session_id = event[:payload][:session_id]
  return unless session_id

  DrainJob.perform_later(session_id)
end