Skip to content

Commit

Permalink
make session lock time configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed Feb 2, 2024
1 parent dee576e commit af52752
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blade/bep/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl publish_build_event_server::PublishBuildEvent for BuildEventService {
if std::time::SystemTime::now()
.duration_since(end)
.unwrap_or(std::time::Duration::from_secs(0))
> std::time::Duration::from_secs(60)
> global.session_lock_time
{
already_over = true;
}
Expand Down
4 changes: 3 additions & 1 deletion blade/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ cfg_if! {
bytestream_overrides: Vec<String>,
#[arg(short='r', long="retention", value_name = "RETENTION", value_parser = humantime::parse_duration)]
retention: Option<std::time::Duration>,
#[arg(short='s', long="session_lock_time", value_name = "LOCK_TIME", value_parser = humantime::parse_duration, default_value="5m")]
session_lock_time: std::time::Duration,
}

#[actix_web::main]
Expand Down Expand Up @@ -66,7 +68,7 @@ cfg_if! {
}
}
let db_manager = db::new(&args.db_path)?;
let state = Arc::new(state::Global { db_manager, allow_local: args.allow_local, bytestream_client: bs, retention: args.retention });
let state = Arc::new(state::Global { db_manager, allow_local: args.allow_local, bytestream_client: bs, retention: args.retention, session_lock_time: args.session_lock_time });
let actix_state = state.clone();
let cleanup_state = state.clone();
log::info!("Starting blade server at: {}", addr.to_string());
Expand Down
1 change: 1 addition & 0 deletions blade/state/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub struct Global {
pub bytestream_client: bytestream::Client,
pub allow_local: bool,
pub retention: Option<std::time::Duration>,
pub session_lock_time: std::time::Duration,
}

}
Expand Down

0 comments on commit af52752

Please sign in to comment.