Class: Upkeep::Delivery::TurboStreams
- Inherits:
-
Object
- Object
- Upkeep::Delivery::TurboStreams
show all
- Defined in:
- lib/upkeep/delivery/turbo_streams.rb
Defined Under Namespace
Classes: Batch, Envelope, Stream
Constant Summary
collapse
- DELIVERY_ERROR =
"delivery_error.upkeep"
Instance Method Summary
collapse
Instance Method Details
#build(plan) ⇒ Object
130
131
132
|
# File 'lib/upkeep/delivery/turbo_streams.rb', line 130
def build(plan)
build_many([plan])
end
|
#build_many(plans) ⇒ Object
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/upkeep/delivery/turbo_streams.rb', line 134
def build_many(plans)
payload = {
plans: plans.size,
planned_targets: plans.sum { |plan| plan.targets.size }
}
ActiveSupport::Notifications.instrument("build_turbo_streams.upkeep", payload) do
streams = plans.flat_map { |plan| stream_targets(plan.targets) }.compact
batch = Batch.new(merge_streams(streams))
payload.merge!(payload_for(batch, rendered_streams: streams))
batch
end
end
|