Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gpuminer initialization #1384

Merged
merged 3 commits into from
Jan 16, 2025
Merged
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
20 changes: 10 additions & 10 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,6 @@ async fn setup_inner(
let last_binaries_update_timestamp = state.config.read().await.last_binaries_update_timestamp();
let now = SystemTime::now();

let _unused = state
.gpu_miner
.write()
.await
.detect(config_dir.clone())
.await
.inspect_err(|e| error!(target: LOG_TARGET, "Could not detect gpu miner: {:?}", e));

HardwareStatusMonitor::current().initialize().await?;

state
.telemetry_manager
.write()
Expand Down Expand Up @@ -456,6 +446,16 @@ async fn setup_inner(
//drop binary resolver to release the lock
drop(binary_resolver);

let _unused = state
.gpu_miner
.write()
.await
.detect(config_dir.clone())
.await
.inspect_err(|e| error!(target: LOG_TARGET, "Could not detect gpu miner: {:?}", e));

HardwareStatusMonitor::current().initialize().await?;

let mut tor_control_port = None;
if use_tor && !cfg!(target_os = "macos") {
state
Expand Down
33 changes: 16 additions & 17 deletions src-tauri/src/telemetry_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,6 @@ impl TelemetryService {
app_version: String,
user: String,
) -> Result<(), TelemetryServiceError> {
let hardware = HardwareStatusMonitor::current();
let cpu_name = hardware.get_cpu_devices().await?;
let cpu_name = match cpu_name.first() {
Some(cpu) => cpu.public_properties.name.clone(),
None => "Unknown".to_string(),
};
let gpu_name = hardware.get_gpu_devices().await?;
let gpu_name = match gpu_name.first() {
Some(gpu) => gpu.public_properties.name.clone(),
None => "Unknown".to_string(),
};
let os = PlatformUtils::detect_current_os();

self.version = app_version;
Expand All @@ -129,8 +118,6 @@ impl TelemetryService {
app_id,
version,
user_id: user,
cpu_name,
gpu_name,
os,
};
tokio::select! {
Expand Down Expand Up @@ -195,8 +182,6 @@ struct SystemInfo {
version: String,
user_id: String,
os: CurrentOperatingSystem,
cpu_name: String,
gpu_name: String,
}

async fn send_telemetry_data(
Expand All @@ -206,6 +191,20 @@ async fn send_telemetry_data(
) -> Result<(), TelemetryServiceError> {
let request = reqwest::Client::new();

let hardware = HardwareStatusMonitor::current();

let cpu_name = hardware.get_cpu_devices().await?;
let cpu_name = match cpu_name.first() {
Some(cpu) => cpu.public_properties.name.clone(),
None => "Unknown".to_string(),
};

let gpu_name = hardware.get_gpu_devices().await?;
let gpu_name = match gpu_name.first() {
Some(gpu) => gpu.public_properties.name.clone(),
None => "Unknown".to_string(),
};

let full_data = FullTelemetryData {
event_name: data.event_name,
event_value: data.event_value,
Expand All @@ -214,8 +213,8 @@ async fn send_telemetry_data(
app_id: system_info.app_id,
version: system_info.version,
os: system_info.os.to_string(),
cpu_name: system_info.cpu_name,
gpu_name: system_info.gpu_name,
cpu_name,
gpu_name,
};
let request_builder = request
.post(api_url)
Expand Down
Loading