Skip to content

Commit

Permalink
updating base images (#160)
Browse files Browse the repository at this point in the history
* updating base images

* update base image

* cache build

* fmt

* make ci green again

* pass linter
  • Loading branch information
darioalessandro authored and mkamonMdt committed Jun 27, 2024
1 parent ed5047b commit 4c3b2c2
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async fn create_client(

// rewrite whatever is in the protobuf so that it seems like it is coming from this bot
if media_packet.email == echo_user {
media_packet.email = email.clone();
media_packet.email.clone_from(&email);

// send the protobuf back to the server
let mut buf = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.actix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM securityunion/rustlemania-api-base:1.72-slim
FROM securityunion/rustlemania-api-base:update-rust-7c189827

RUN rustup component add clippy
RUN rustup component add rustfmt
2 changes: 1 addition & 1 deletion docker/Dockerfile.yew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM securityunion/yew:1.72-slim
FROM securityunion/yew:update-rust-7c189827

RUN rustup component add clippy
RUN rustup component add rustfmt
2 changes: 1 addition & 1 deletion docker/base_images/Dockerfile.actix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72-slim
FROM rust:1.79-slim

RUN apt-get --yes update && apt-get --yes install curl git pkg-config libssl-dev
RUN curl https://github.com/amacneil/dbmate/releases/download/v2.4.0/dbmate-linux-amd64 -L -o /usr/bin/dbmate && chmod +x /usr/bin/dbmate
Expand Down
2 changes: 1 addition & 1 deletion docker/base_images/Dockerfile.yew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72-slim as development
FROM rust:1.79-slim as development

RUN rustup default nightly-2023-12-13
RUN apt-get --yes update && apt-get --yes install git pkg-config libssl-dev
Expand Down
7 changes: 7 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
target: /app
- /app/target
- rustlemania-yew-ui-cargo-registry-cache:/usr/local/cargo/registry
- rustlemania-yew-ui-cache:/app/yew-ui/target


build:
dockerfile: ../docker/Dockerfile.yew
Expand Down Expand Up @@ -51,6 +53,7 @@ services:
target: /app
- /app/target
- rustlemania-actix-web-cargo-registry-cache:/usr/local/cargo/registry
- rustlemania-actix-web-target-cache:/app/actix-api/target

depends_on:
- postgres
Expand All @@ -76,6 +79,7 @@ services:
target: /app
- /app/target
- rustlemania-actix-webtransport-cargo-registry-cache:/usr/local/cargo/registry
- rustlemania-actix-webtransport-cache:/app/actix-api/target

depends_on:
- nats
Expand Down Expand Up @@ -110,3 +114,6 @@ volumes:
rustlemania-actix-web-cargo-registry-cache:
rustlemania-actix-webtransport-cargo-registry-cache:
rustlemania-yew-ui-cargo-registry-cache:
rustlemania-actix-web-target-cache:
rustlemania-actix-webtransport-cache:
rustlemania-yew-ui-cache:
2 changes: 1 addition & 1 deletion protobuf/build-env-rust.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72-slim
FROM rust:1.79-slim
ENV DEBIAN_FRONTEND=noninteractive
ARG USER
ARG UID
Expand Down
3 changes: 1 addition & 2 deletions videocall-client/src/client/video_call_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,14 @@ impl VideoCallClient {
Ok(mut inner) => {
inner.peer_decode_manager.run_peer_monitor();
on_connection_lost.emit(());
},
}
Err(_) => {
error!("Unable to borrow inner -- not starting peer monitor");
}
}
}
})
},

};
info!(
"webtransport connect = {}",
Expand Down
4 changes: 3 additions & 1 deletion videocall-client/src/connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ impl Connection {
let mut connection = Self {
task: Rc::new(Task::connect(webtransport, options)?),
heartbeat: None,
heartbeat_monitor: Some(Interval::new(5000, move || {monitor.emit(());})),
heartbeat_monitor: Some(Interval::new(5000, move || {
monitor.emit(());
})),
status,
aes,
};
Expand Down
12 changes: 6 additions & 6 deletions videocall-client/src/decode/hash_map_with_ordered_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ impl<K: Ord + Hash + Clone, V> HashMapWithOrderedKeys<K, V> {

pub fn remove_if<F>(&mut self, predicate: F)
where
F: Fn(&mut V) -> bool
F: Fn(&mut V) -> bool,
{
let mut keys_to_remove = Vec::new();

for key in &self.keys{
for key in &self.keys {
if let Some(value) = self.map.get_mut(key) {
if !predicate(value){
if !predicate(value) {
keys_to_remove.push(key.clone());
}
}
}
}

for key in &keys_to_remove {
self.map.remove(&key);
for key in &keys_to_remove {
self.map.remove(key);
self.keys.retain(|k| k != key);
}
}
Expand Down
15 changes: 9 additions & 6 deletions videocall-client/src/decode/peer_decode_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Peer {
video_canvas_id,
screen_canvas_id,
aes,
heartbeat_count: 1
heartbeat_count: 1,
}
}

Expand Down Expand Up @@ -148,7 +148,7 @@ impl Peer {
MediaType::HEARTBEAT => Ok((
media_type,
DecodeStatus {
rendered: false,
_rendered: false,
first_frame: false,
},
)),
Expand All @@ -160,12 +160,15 @@ impl Peer {
}

pub fn check_heartbeat(&mut self) -> bool {
if self.heartbeat_count != 0 {
if self.heartbeat_count != 0 {
self.heartbeat_count = 0;
return true;
}
debug!("---@@@--- detected heartbeat stop for {}", self.email.clone());
return false;
debug!(
"---@@@--- detected heartbeat stop for {}",
self.email.clone()
);
false
}
}

Expand Down Expand Up @@ -214,7 +217,7 @@ impl PeerDecodeManager {
Ok((MediaType::HEARTBEAT, _)) => {
peer.on_heartbeat();
Ok(())
},
}
Ok((media_type, decode_status)) => {
if decode_status.first_frame {
self.on_first_frame.emit((email.clone(), media_type));
Expand Down
4 changes: 2 additions & 2 deletions videocall-client/src/decode/peer_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use web_sys::{MediaStreamTrackGenerator, MediaStreamTrackGeneratorInit};
use web_sys::{VideoDecoderConfig, VideoDecoderInit, VideoFrame};

pub struct DecodeStatus {
pub rendered: bool,
pub _rendered: bool,
pub first_frame: bool,
}

Expand Down Expand Up @@ -88,7 +88,7 @@ macro_rules! impl_decode {
}
}
Ok(DecodeStatus {
rendered: true,
_rendered: true,
first_frame,
})
}};
Expand Down
2 changes: 1 addition & 1 deletion videocall-client/src/decode/video_decoder_with_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<T: VideoDecoderTrait> VideoDecoderWithBuffer<T> {
let is_future_frame = new_sequence_number > sequence;
let is_future_i_frame = is_future_frame && frame_type == EncodedVideoChunkType::Key;
let is_next_frame = new_sequence_number == sequence + 1;
let next_frame_already_cached = self.cache.get(&(sequence + 1)).is_some();
let next_frame_already_cached = self.cache.contains_key(&(sequence + 1));
if is_future_i_frame || is_next_frame {
self.video_decoder.decode(image);
self.sequence = Some(new_sequence_number);
Expand Down

0 comments on commit 4c3b2c2

Please sign in to comment.