Skip to content

Commit

Permalink
Merge pull request #4104 from zendesk/grosser/stream
Browse files Browse the repository at this point in the history
fix job streaming
  • Loading branch information
grosser authored Feb 14, 2024
2 parents 6b0206b + dcf54a0 commit d241d1f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/channels/job_outputs_channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ def stream_execution(execution)
execution.viewers.push current_user
builder = EventBuilder.new(execution.job)
execution.output.each do |event, data|
transmit event: event, data: builder.payload(event, data)
transmit({event: event, data: builder.payload(event, data)})
end
end

# send fake output (reproduce by deploying a bad ref)
def stream_finished_output(job)
builder = EventBuilder.new(job)
transmit event: :started, data: builder.payload(:started, nil)
transmit({event: :started, data: builder.payload(:started, nil)})
job.output.each_line do |line|
transmit event: :message, data: builder.payload(:message, line)
transmit({event: :message, data: builder.payload(:message, line)})
end
transmit event: :finished, data: builder.payload(:finished, nil)
transmit({event: :finished, data: builder.payload(:finished, nil)})
end
end

0 comments on commit d241d1f

Please sign in to comment.