Skip to content

Commit 9ae50ef

Browse files
authored
Expire sessions after 1 hour (#42)
It looks like something changed with either GitHub or browsers such that GitHub is frequently giving 401s. I'm not sure whether that's because they're expiring tokens more readily, or sessions are lasting longer than they used to. Ideally Octocrab would notice 401s and force a re-auth, but it doesn't have an obvious hook for that. Instead, just expire sessions after an hour so that we will stop seeing existing tokens, and will automatically redirect people to fetch new tokens.
1 parent 8769e31 commit 9ae50ef

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ serde_json = "1"
4444
serde_urlencoded = "0.7.1"
4545
sheets = "0.7.0"
4646
slack-with-types = "0.1.1"
47+
time = "0.3.44"
4748
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
4849
tower = "0.5.2"
4950
tower-http = { version = "0.6.6", features = ["fs"] }

src/bin/trainee-tracker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn main() {
4747
let session_store = MemoryStore::default();
4848
let session_layer = SessionManagerLayer::new(session_store)
4949
.with_secure(is_secure)
50-
.with_expiry(Expiry::OnSessionEnd);
50+
.with_expiry(Expiry::OnInactivity(time::Duration::HOUR));
5151

5252
let app = axum::Router::new()
5353
.route("/api/ok", get(trainee_tracker::endpoints::health_check))

0 commit comments

Comments
 (0)