Skip to content

Commit

Permalink
Merge pull request #140 from gertrude-app/connect-improve
Browse files Browse the repository at this point in the history
api: try to prevent/improve expired/404 app connect errors

n a weird stretch where almost nobody is successfully onboarding, can't figure out why. have seen at least 2 "expired/not found" connection code errors, so bumping the alive time to 2 days, and tweaking the error message to make it more explicit that they can click to create a new code when this happens.
  • Loading branch information
jaredh159 authored Jan 13, 2025
2 parents fbc9a1c + 983c1fe commit d479c5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions api/Sources/Api/Environment/Ephemeral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ actor Ephemeral {
let token = self.uuid()
self.adminIds[token] = (
adminId: adminId,
expiration: expiration ?? self.now + ONE_HOUR
expiration: expiration ?? self.now + .minutes(60)
)
return token
}
Expand Down Expand Up @@ -75,7 +75,7 @@ actor Ephemeral {
self.pendingMethods[model.id] = (
model: model,
code: code,
expiration: expiration ?? self.now + ONE_HOUR
expiration: expiration ?? self.now + .minutes(60)
)
return code
}
Expand Down Expand Up @@ -104,7 +104,7 @@ actor Ephemeral {
}
self.pendingAppConnections[code] = (
userId: userId,
expiration: expiration ?? self.now + ONE_HOUR
expiration: expiration ?? self.now + .days(2)
)
return code
}
Expand All @@ -121,8 +121,6 @@ actor Ephemeral {
}
}

private let ONE_HOUR: TimeInterval = 60 * 60

// dependency

extension DependencyValues {
Expand Down
2 changes: 1 addition & 1 deletion api/Sources/Api/PairQL/MacApp/Resolvers/ConnectUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension ConnectUser: Resolver {
id: "6e7fc234",
type: .unauthorized,
debugMessage: "verification code not found",
userMessage: "Connection code not found, or expired. Please try again.",
userMessage: "Connection code expired, or not found. Plese create a new code and try again.",
appTag: .connectionCodeNotFound
)
}
Expand Down

0 comments on commit d479c5f

Please sign in to comment.