Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Send rtc_stream.update with closing time when the backend goes offline (
Browse files Browse the repository at this point in the history
  • Loading branch information
feymartynov committed Sep 28, 2020
1 parent 87590ba commit 7a0378c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/janus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,9 +1244,12 @@ async fn handle_status_event_impl<C: Context>(
Ok(streams_with_rtc)
})?;

let now = Utc::now();
let mut events = Vec::with_capacity(streams_with_rtc.len());

for (stream, rtc) in streams_with_rtc {
for (mut stream, rtc) in streams_with_rtc {
stream.set_time(stream.time().map(|t| (t.0, Bound::Excluded(now))));

let event = endpoint::rtc_stream::update_event(
rtc.room_id(),
stream,
Expand Down
5 changes: 5 additions & 0 deletions src/db/janus_rtc_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ impl Object {
pub(crate) fn created_at(&self) -> DateTime<Utc> {
self.created_at
}

pub(crate) fn set_time(&mut self, time: Option<Time>) -> &mut Self {
self.time = time;
self
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7a0378c

Please sign in to comment.