File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -91,19 +91,26 @@ async function syncLoop() {
91
91
export let skew : number | null = null ;
92
92
let rtt : number | null = null ;
93
93
export const getSkew = reuseInFlight ( async ( ) : Promise < number > => {
94
- if ( process . env . COCALC_TEST_MODE ) {
94
+ if ( process . env . COCALC_TEST_MODE || process . env . COCALC_PROJECT_ID ) {
95
+ // projects and test mode assumed to have correct time
95
96
skew = 0 ;
96
97
return skew ;
97
98
}
98
- await waitUntilConnected ( ) ;
99
- const start = Date . now ( ) ;
100
- const client = getClient ( ) ;
101
- const tc = timeClient ( client ) ;
102
- const serverTime = await tc . time ( ) ;
103
- const end = Date . now ( ) ;
104
- rtt = end - start ;
105
- skew = start + rtt / 2 - serverTime ;
106
- return skew ;
99
+ try {
100
+ await waitUntilConnected ( ) ;
101
+ const start = Date . now ( ) ;
102
+ const client = getClient ( ) ;
103
+ const tc = timeClient ( client ) ;
104
+ const serverTime = await tc . time ( ) ;
105
+ const end = Date . now ( ) ;
106
+ rtt = end - start ;
107
+ skew = start + rtt / 2 - serverTime ;
108
+ return skew ;
109
+ } catch ( err ) {
110
+ console . log ( "WARNING: temporary issue syncing time" , err ) ;
111
+ skew = 0 ;
112
+ return 0 ;
113
+ }
107
114
} ) ;
108
115
109
116
export async function waitUntilTimeAvailable ( ) {
Original file line number Diff line number Diff line change 1
1
/* autogenerated by the update_version script */
2
- exports . version = 1747238145 ;
2
+ exports . version = 1747260598 ;
You can’t perform that action at this time.
0 commit comments