v2.2.1: fix ws & rest authentication issues caused by time-sync mechanism

This commit is contained in:
tiagosiebler
2022-05-28 20:39:37 +01:00
parent 9eda2f2bd9
commit 18977499f8
5 changed files with 70 additions and 4 deletions

View File

@@ -288,9 +288,10 @@ export default abstract class BaseRestClient {
}
const end = Date.now();
const severTimeMs = serverTime * 1000;
const avgDrift = (end - start) / 2;
return Math.ceil(serverTime - end + avgDrift);
return Math.ceil(severTimeMs - end + avgDrift);
} catch (e) {
console.error('Failed to fetch get time offset: ', e);
return 0;