Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mod tray;
mod update_project_names;
mod updates;
mod upload;
pub mod upload_health;
pub mod web_api;
mod window_exclusion;
mod window_position_persistence;
Expand Down Expand Up @@ -6959,6 +6960,8 @@ fn specta_builder() -> tauri_specta::Builder {
updates::updates_download_and_install,
restart_app,
updates::updates_channel_changed,
upload_health::get_upload_health_status,
upload_health::refresh_upload_health_status,
])
.events(tauri_specta::collect_events![
linux_instant_camera::CameraPresentationRequested,
Expand Down Expand Up @@ -6995,6 +6998,7 @@ fn specta_builder() -> tauri_specta::Builder {
updates::UpdateDownloadProgress,
updates::UpdateReady,
diagnostics::DiagnosticProgress,
upload_health::UploadHealthUpdated,
])
.error_handling(tauri_specta::ErrorHandlingMode::Throw)
.typ::<ProjectConfiguration>()
Expand Down Expand Up @@ -7283,6 +7287,8 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: Option<PathB
app.manage(editor_preparing::PreparingConsumers::default());
app.manage(updates::UpdatesState::default());
updates::spawn_background_loop(app.clone());
app.manage(Arc::new(upload_health::UploadHealthManager::default()));
upload_health::spawn_startup_check(app.clone());

#[cfg(unix)]
{
Expand Down
9 changes: 8 additions & 1 deletion apps/desktop/src-tauri/src/recording.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@ async fn start_recording_prepared(
app_state.was_camera_only_recording = true;
}
}
crate::upload_health::cancel_in_flight_probe(&app).await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Linux cancels probes too late

On Linux, this cancellation runs after clean_capture::prepare returns. That function already sets RecordingState::Pending and waits for the user's shortcut. A probe uploading when preparation starts can keep using the connection throughout that wait. Cancel the probe when the recording first becomes pending, including this earlier path.

Knowledge Base Used: Desktop recording orchestration

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/recording.rs
Line: 2074

Comment:
**Linux cancels probes too late**

On Linux, this cancellation runs after `clean_capture::prepare` returns. That function already sets `RecordingState::Pending` and waits for the user's shortcut. A probe uploading when preparation starts can keep using the connection throughout that wait. Cancel the probe when the recording first becomes pending, including this earlier path.

**Knowledge Base Used:** [Desktop recording orchestration](https://app.greptile.com/cap/-/custom-context/knowledge-base/capsoftware/cap/-/docs/desktop-recording-orchestration.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.


let storage_generation = crate::clean_capture::generation(&app);
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -2303,14 +2304,20 @@ async fn start_recording_prepared(
notify_recording_start_failed(&app, &error);
return Err(error);
};
let instant_mode_max_resolution = if auth.is_upgraded() {
let configured_max_resolution = if auth.is_upgraded() {
general_settings
.map_or(cap_recording::PRO_INSTANT_MODE_MAX_RESOLUTION, |settings| {
settings.instant_mode_max_resolution
})
} else {
cap_recording::FREE_INSTANT_MODE_MAX_RESOLUTION
};
let instant_mode_max_resolution =
crate::upload_health::resolve_instant_max_resolution(
&app,
configured_max_resolution,
)
.await;
let upload_mode = if matches!(inputs.capture_target, ScreenCaptureTarget::CameraOnly) {
"desktopMP4"
} else {
Expand Down
Loading