Module: Pollen::Commands
- Included in:
- Controller
- Defined in:
- lib/pollen/commands.rb
Instance Method Summary collapse
- #completed!(stream_or_id, payload) ⇒ Object
- #failed!(stream_or_id, payload) ⇒ Object
- #push!(stream_or_id, event, payload) ⇒ Object
Instance Method Details
#completed!(stream_or_id, payload) ⇒ Object
5 6 7 |
# File 'lib/pollen/commands.rb', line 5 def completed!(stream_or_id, payload) push!(stream_or_id, :completed, payload) end |
#failed!(stream_or_id, payload) ⇒ Object
9 10 11 |
# File 'lib/pollen/commands.rb', line 9 def failed!(stream_or_id, payload) push!(stream_or_id, :failed, payload) end |
#push!(stream_or_id, event, payload) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pollen/commands.rb', line 13 def push!(stream_or_id, event, payload) check_redis! stream = load_stream(stream_or_id) stream.update!(status: %i[completed failed].include?(event) && event || :pending, payload:) with_redis do |r| r.publish("#{configuration.channel_prefix}:#{stream.id}", "#{event}:#{payload}") end end |