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

Revert "EPROD 653 define how to handle panics in the task scheduler" #209

Merged
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ members = [
]

[workspace.package]
version = "0.13.0"
version = "0.14.0"
edition = "2021"

[workspace.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"type": "custom"
},
"log_canister": {
"build": "bash scripts/build_log_canister.sh",
"build": "",
"candid": "target/wasm32-unknown-unknown/release/log_canister.did",
"wasm": "target/wasm32-unknown-unknown/release/examples/log_canister.wasm",
"wasm": "target/wasm32-unknown-unknown/release/log_canister.wasm",
"type": "custom"
},
"dummy_scheduler_canister": {
Expand Down
4 changes: 4 additions & 0 deletions ic-task-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ edition.workspace = true

[dependencies]
bincode = { workspace = true }
candid = { workspace = true }
ic-cdk-timers = { workspace = true }
ic-kit = { path = "../ic-kit" }
ic-stable-structures = { path = "../ic-stable-structures" }
log = { workspace = true }
parking_lot = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
candid = { workspace = true }
ic-canister-client = { path = "../ic-canister-client", features = ["pocket-ic-client"]}
ic-exports = { path = "../ic-exports", features = ["pocket-ic-tests-async"] }
once_cell = { workspace = true }
rand = { workspace = true }
Expand Down
9 changes: 6 additions & 3 deletions ic-task-scheduler/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use candid::CandidType;
use serde::{Deserialize, Serialize};
use thiserror::Error;

#[derive(Debug, Error)]
#[derive(CandidType, Debug, Error, PartialEq, Eq, Serialize, Deserialize)]
pub enum SchedulerError {
#[error("TaskExecutionFailed: {0}")]
TaskExecutionFailed(String),
#[error("storage error: {0}")]
StorageError(#[from] ic_stable_structures::Error),
}

/// Result type for the scheduler
pub type Result<T> = std::result::Result<T, SchedulerError>;
4 changes: 1 addition & 3 deletions ic-task-scheduler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ pub mod scheduler;
pub mod task;
mod time;

pub use error::SchedulerError;
/// Result type for the scheduler
pub type Result<T> = std::result::Result<T, SchedulerError>;
pub use error::{Result, SchedulerError};
7 changes: 4 additions & 3 deletions ic-task-scheduler/src/retry.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use core::fmt::Debug;

use candid::CandidType;
use serde::{Deserialize, Serialize};

/// Defines the strategy to apply in case of a failure.
/// This is applied, for example, when a task execution fails
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
#[derive(CandidType, Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct RetryStrategy {
pub retry_policy: RetryPolicy,
pub backoff_policy: BackoffPolicy,
Expand All @@ -30,7 +31,7 @@ impl RetryStrategy {
}

// Defines the retry policy of a RetryStrategy
#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq, Eq)]
#[derive(CandidType, Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub enum RetryPolicy {
/// No Retry attempts defined
None,
Expand All @@ -55,7 +56,7 @@ impl RetryPolicy {
}

// Defines the backoff policy of a RetryStrategy
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
#[derive(CandidType, Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub enum BackoffPolicy {
/// No backoff, the retry will be attempted without waiting
None,
Expand Down
Loading