Successful remote config fetch should unexpire app
This commit is contained in:
parent
533a1b32d4
commit
fde9facad5
1 changed files with 10 additions and 0 deletions
|
@ -76,6 +76,7 @@ export const refreshRemoteConfig = async (
|
|||
): Promise<void> => {
|
||||
const now = Date.now();
|
||||
const { config: newConfig, serverEpochTime } = await server.getConfig();
|
||||
|
||||
const serverTimeSkew = serverEpochTime * SECOND - now;
|
||||
|
||||
if (Math.abs(serverTimeSkew) > HOUR) {
|
||||
|
@ -127,6 +128,15 @@ export const refreshRemoteConfig = async (
|
|||
};
|
||||
}, {});
|
||||
|
||||
// If remote configuration fetch worked - we are not expired anymore.
|
||||
if (
|
||||
!getValue('desktop.clientExpiration') &&
|
||||
window.storage.get('remoteBuildExpiration') != null
|
||||
) {
|
||||
log.warn('Remote Config: clearing remote expiration on successful fetch');
|
||||
await window.storage.remove('remoteBuildExpiration');
|
||||
}
|
||||
|
||||
await window.storage.put('remoteConfig', config);
|
||||
await window.storage.put('serverTimeSkew', serverTimeSkew);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue