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

feat(gateway): override idle timer for cch projects #1430

Merged
merged 2 commits into from Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions gateway/src/api/latest.rs
Expand Up @@ -209,13 +209,14 @@ async fn create_project(
CustomErrorPath(project_name): CustomErrorPath<ProjectName>,
AxumJson(config): AxumJson<project::Config>,
) -> Result<AxumJson<project::Response>, Error> {
let cch_modifier = project_name.starts_with("cch23-");

// Check that the user is within their project limits.
let temporary_increase = project_name.starts_with("cch23-") as u32;
let can_create_project = claim.can_create_project(
service
.get_project_count(&name)
.await?
.saturating_sub(temporary_increase),
.saturating_sub(cch_modifier as u32),
);

let project = service
Expand All @@ -224,7 +225,7 @@ async fn create_project(
name.clone(),
claim.is_admin(),
can_create_project,
config.idle_minutes,
if cch_modifier { 5 } else { config.idle_minutes },
)
.await?;
let idle_minutes = project.state.idle_minutes();
Expand Down