Skip to content

Commit

Permalink
fix: minor development bug fixes (#806)
Browse files Browse the repository at this point in the history
* fix: old projects deserialized without idle-minutes

* fix: cargo-chef cook failure
  • Loading branch information
oddgrd authored Apr 20, 2023
1 parent b048d9c commit c596e46
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ jobs:
linux-qa:
machine:
image: ubuntu-2004:current
resource_class: xlarge
resource_class: xlarge
steps:
- checkout
- run:
Expand Down
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions cargo-shuttle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ features = ["models"]
[dependencies.shuttle-proto]
workspace = true

[dependencies.shuttle-secrets]
version = "0.14.0"
path = "../resources/secrets"

[dependencies.shuttle-service]
workspace = true
features = ["builder"]
Expand Down
7 changes: 6 additions & 1 deletion common/src/models/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ use std::fmt::{Display, Formatter};
use strum::EnumString;
use utoipa::ToSchema;

// Timeframe before a project is considered idle
/// Timeframe before a project is considered idle
pub const IDLE_MINUTES: u64 = 30;

/// Function to set [IDLE_MINUTES] as a serde default
pub const fn idle_minutes() -> u64 {
IDLE_MINUTES
}

#[derive(Deserialize, Serialize, Clone, ToSchema)]
#[schema(as = shuttle_common::models::project::Response)]
pub struct Response {
Expand Down
3 changes: 2 additions & 1 deletion gateway/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use hyper::Client;
use once_cell::sync::Lazy;
use rand::distributions::{Alphanumeric, DistString};
use serde::{Deserialize, Serialize};
use shuttle_common::models::project::IDLE_MINUTES;
use shuttle_common::models::project::{idle_minutes, IDLE_MINUTES};
use tokio::time::{sleep, timeout};
use tracing::{debug, error, info, instrument};

Expand Down Expand Up @@ -582,6 +582,7 @@ pub struct ProjectCreating {
#[serde(default)]
recreate_count: usize,
/// Label set on container as to how many minutes to wait before a project is considered idle
#[serde(default = "idle_minutes")]
idle_minutes: u64,
}

Expand Down

0 comments on commit c596e46

Please sign in to comment.