File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
packages/common/src/client/sync/stream Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,6 @@ export type RemoteConnector = {
21
21
const POWERSYNC_TRAILING_SLASH_MATCH = / \/ + $ / ;
22
22
const POWERSYNC_JS_VERSION = PACKAGE . version ;
23
23
24
- // Refresh at least 30 sec before it expires
25
- const REFRESH_CREDENTIALS_SAFETY_PERIOD_MS = 30_000 ;
26
24
const SYNC_QUEUE_REQUEST_LOW_WATER = 5 ;
27
25
28
26
// Keep alive message is sent every period
Original file line number Diff line number Diff line change @@ -691,6 +691,11 @@ The next upload iteration will be delayed.`);
691
691
*/
692
692
await this . delayRetry ( ) ;
693
693
return ;
694
+ } else if ( remaining_seconds < 30 ) {
695
+ this . logger . debug ( 'Token will expire soon; reconnect' ) ;
696
+ // Pre-emptively refresh the token
697
+ this . options . remote . invalidateCredentials ( ) ;
698
+ return ;
694
699
}
695
700
this . triggerCrudUpload ( ) ;
696
701
} else {
You can’t perform that action at this time.
0 commit comments