Method: OpenC3::SortedModel#notify

Defined in:
lib/openc3/models/sorted_model.rb

#notify(kind:, extra: nil) ⇒ Object

Returns [] update the redis stream / timeline topic that something has changed.

Returns:

  • update the redis stream / timeline topic that something has changed



145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/openc3/models/sorted_model.rb', line 145

def notify(kind:, extra: nil)
  notification = {
    'data' => JSON.generate(as_json(:allow_nan => true)),
    'kind' => kind,
    'type' => 'calendar',
  }
  notification['extra'] = extra unless extra.nil?
  begin
    CalendarTopic.write_entry(notification, scope: @scope)
  rescue StandardError => e
    raise SortedError.new "Failed to write to stream: #{notification}, #{e}"
  end
end