Skip to content

Commit 792d686

Browse files
authored
remove out of attempts (#94)
1 parent ceb4de7 commit 792d686

File tree

13 files changed

+13
-73
lines changed

13 files changed

+13
-73
lines changed

core/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dcl-launcher-core"
3-
version = "1.3.0"
3+
version = "1.3.1"
44
edition = "2024"
55

66
[lib]

core/src/attempts.rs

Lines changed: 0 additions & 31 deletions
This file was deleted.

core/src/errors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ use super::types::Status;
88

99
pub struct FlowError {
1010
pub user_message: String,
11-
pub can_retry: bool,
1211
}
1312

1413
impl From<&FlowError> for Status {
1514
fn from(err: &FlowError) -> Self {
1615
Status::Error {
1716
message: err.user_message.to_owned(),
18-
can_retry: err.can_retry,
1917
}
2018
}
2119
}

core/src/flow.rs

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use crate::channel::EventChannel;
22
use crate::{
33
analytics::{Analytics, event::Event},
4-
attempts::Attempts,
54
environment::AppEnvironment,
6-
errors::{FlowError, StepError, StepResult},
5+
errors::{FlowError, StepResult},
76
installs::{self, InstallsHub},
87
s3::{self, ReleaseResponse},
98
types::{BuildType, Status, Step},
@@ -50,8 +49,7 @@ trait LaunchStep {
5049
#[derive(Default)]
5150
pub struct LaunchFlowState {
5251
latest_release: Option<ReleaseResponse>,
53-
recent_download: Option<RecentDownload>,
54-
attempts: Attempts,
52+
recent_download: Option<RecentDownload>
5553
}
5654

5755
#[derive(Clone)]
@@ -90,10 +88,8 @@ impl LaunchFlow {
9088
if let Err(e) = result {
9189
log::error!("Error during the flow {} {:#?}", e, e);
9290
sentry::capture_error(&e);
93-
let can_retry = Self::can_retry(state).await;
9491
let error = FlowError {
95-
user_message: e.user_message().to_owned(),
96-
can_retry,
92+
user_message: e.user_message().to_owned()
9793
};
9894
return std::result::Result::Err(error);
9995
}
@@ -106,7 +102,6 @@ impl LaunchFlow {
106102
channel: &T,
107103
state: Arc<Mutex<LaunchFlowState>>,
108104
) -> StepResult {
109-
Self::validate_attempt_and_increase(state.clone()).await?;
110105
self.fetch_step
111106
.execute_if_needed(channel, state.clone(), "fetch")
112107
.await?;
@@ -121,27 +116,6 @@ impl LaunchFlow {
121116
.await?;
122117
StepResult::Ok(())
123118
}
124-
125-
async fn validate_attempt_and_increase(state: Arc<Mutex<LaunchFlowState>>) -> StepResult {
126-
let mut guard = state.lock().await;
127-
128-
if guard.attempts.try_consume_attempt() {
129-
return StepResult::Ok(());
130-
}
131-
132-
let message = "Out of attempts";
133-
let inner_error = anyhow!(message);
134-
let error = StepError::E0000_GENERIC_ERROR {
135-
error: inner_error,
136-
user_message: Some(message.to_owned()),
137-
};
138-
StepResult::Err(error)
139-
}
140-
141-
async fn can_retry(state: Arc<Mutex<LaunchFlowState>>) -> bool {
142-
let guard = state.lock().await;
143-
guard.attempts.can_retry()
144-
}
145119
}
146120

147121
struct FetchStep {}

core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
pub mod analytics;
22
pub mod app;
3-
mod attempts;
43
pub mod channel;
54
mod config;
65
pub mod environment;

core/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub enum Status {
66
#[serde(rename_all = "camelCase")]
77
State { step: Step },
88
#[serde(rename_all = "camelCase")]
9-
Error { message: String, can_retry: bool },
9+
Error { message: String },
1010
}
1111

1212
#[derive(Clone, Serialize)]

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Decentraland",
33
"private": true,
4-
"version": "1.3.0",
4+
"version": "1.3.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)