Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
16
backend/app/jobs/stream_analytics_job.rb
Normal file
16
backend/app/jobs/stream_analytics_job.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class StreamAnalyticsJob
|
||||
include Sidekiq::Job
|
||||
|
||||
def perform(session_id)
|
||||
session = StreamSession.find_by(id: session_id)
|
||||
return unless session&.ended?
|
||||
|
||||
duration = session.total_duration_secs
|
||||
disconnects = session.disconnection_count
|
||||
session.stream_events.create!(
|
||||
event_type: "quality_changed",
|
||||
metadata: { analytics: true, duration: duration, disconnects: disconnects },
|
||||
occurred_at: Time.current
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user