Skip to main content

TOKEN_EXPIRY_MARGIN_SECS

Constant TOKEN_EXPIRY_MARGIN_SECS 

Source
const TOKEN_EXPIRY_MARGIN_SECS: i64 = 60;
Expand description

How long before expiry a cached token stops being handed out.

A token refreshed at the instant it expires still races the request it was fetched for: the round trip takes time, and the server’s clock need not agree with ours to the second. Renewing a minute early costs one extra token request per lifetime and removes both problems.