gcsfs icon indicating copy to clipboard operation
gcsfs copied to clipboard

Remove deprecated property usage

Open dbalabka opened this issue 1 year ago • 4 comments

In the scope of #627, I found that gcsfs uses a deprecated approach to check the token validity. Using self.credentials.token_state == google.auth.credentials.TokenState.FRESH allows to refresh the token a bit earlier using a threshold:

# The smallest MDS cache used by this library stores tokens until 4 minutes from
# expiry.
REFRESH_THRESHOLD = datetime.timedelta(minutes=3, seconds=45)

Important! This change requires v2.26.0

Now, a token might have 3 states:

Tracks the state of a token. FRESH: The token is valid. It is not expired or close to expired, or the token has no expiry. STALE: The token is close to expired, and should be refreshed. The token can be used normally. INVALID: The token is expired or invalid. The token cannot be used for a normal operation.

In a nutshell, FRESH means that a token has more than 3 minutes and 45 seconds till the real expiration time.

dbalabka avatar Jun 27 '24 11:06 dbalabka

This change requires v2.26.0

Since that version is pretty new, we should support both ways rather than force everyone to upgrade. Can you please link where the new behaviour was introduced upstream, please (or a link to TokenState's doc) ?

martindurant avatar Jun 27 '24 14:06 martindurant

@martindurant , here is a PR: https://github.com/googleapis/google-auth-library-python/pull/1368

I'm not sure they have documentation yet. Also, let's skip this change for now unless it is required. I assumed it would fix my issue with a token refresh (see #627), but it seems it is not related. Hence, we can close this PR unmerged

dbalabka avatar Jun 27 '24 21:06 dbalabka

let's skip this change for now unless it is required

I'm happy to leave it open for others to see, and we'll probably need it eventually.

martindurant avatar Jun 28 '24 20:06 martindurant

A year has passed... what is the status of upstream use of this type now?

martindurant avatar Sep 02 '25 19:09 martindurant