Skip to main content

Module login_recheck

Module login_recheck 

Source
Expand description

A pane left signed out by a login that has since been signed in again clears itself (#47468).

A pane whose last turn was refused on its login keeps that failure until a clean turn or a sign-in that srv saw (super::after_sign_in) clears it, and a signed-out pane holds its messages, so no turn can run to clear it. A person signing in from a pane’s own CLI, or a credentials file that came back, reached neither: the pane stayed “Not authenticated” for hours after the account read signed in, and a restart did not help.

On every tick, a signed-out pane whose account holds a token that is still good has its failure cleared and is told, as after a sign-in. An access token that expired is no longer good, so the token a turn was refused on for that reason cannot pass. A token the provider refuses for another reason (revoked, say) can: it is tried once for a pane per TRIED_MS and not again, so such a login costs one turn, not one a tick.

Constants§

TRIED_MS 🔒
How long a try is remembered. Clearing a pane removes its failure, so the pane leaves the signed-out set at once: the memory has to outlive that, or a login the provider keeps refusing would be tried again at every failure.

Statics§

TRIED 🔒
For each pane, the token expiry it was last cleared for and when: the same token is not tried twice within TRIED_MS.

Functions§

first_try 🔒
Records that expiry_ms is tried for block_id at now_ms; false when it already was within TRIED_MS. Entries older than that are dropped.
is_good_token 🔒
Whether the credentials file holds a token that is still good at now_ms (unix ms). The failure being cleared is a past one, so a token good now is not the expired one the turn was refused on; it can still be one the provider refuses for another reason (revoked), which first_try bounds.
run 🔒
Clear the signed-out panes among panes whose login is new, and tell them. BLOCKING.