Files
MatchLiveTv/backend/app/services/recordings/notify_ready.rb
Emiliano Frascaro da75582dae Sposta storage video su disco dedicato e completa ops/SMTP in produzione.
Recordings e Garage usano bind mount su /media/videos; aggiunge ntfy self-hosted,
notifiche critical+warning, SMTP Aruba SSL/465 e fix cron replay.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 23:13:08 +02:00

37 lines
1018 B
Ruby

module Recordings
class NotifyReady
def initialize(recording)
@recording = recording
end
def call
return @recording if @recording.ready_notified_at.present?
return @recording unless @recording.ready?
recipients.each do |user|
deliver_replay_ready(user)
end
@recording.update!(ready_notified_at: Time.current)
@recording
end
private
def deliver_replay_ready(user)
Recordings::ReplayMailer.replay_ready(recording: @recording, recipient: user).deliver_now
rescue EOFError => e
# Aruba SMTP (465/SSL) chiude la socket prima del QUIT: la mail è già partita.
Rails.logger.warn("[Recordings::NotifyReady] SMTP EOF on close for #{user.email}: #{e.message}")
end
def recipients
club = @recording.team.club
owner = club.owner
users = club.users.distinct.to_a
users << owner if owner && users.none? { |u| u.id == owner.id }
users.uniq.select { |u| u.email.present? }
end
end
end