Skip to content

Commit

Permalink
Clean cache on Identity constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-niculescu-sch committed Apr 9, 2024
1 parent ca911dd commit 3a1e87e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@schibsted/account-sdk-browser",
"version": "4.8.7-beta.6",
"version": "4.8.7-beta.7",
"description": "Schibsted account SDK for browsers",
"main": "index.js",
"type": "module",
Expand Down
7 changes: 2 additions & 5 deletions src/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,10 @@ export class Identity extends EventEmitter {
this.log = log;
this.callbackBeforeRedirect = callbackBeforeRedirect;
this._sessionDomain = sessionDomain;
if (this._enableSessionCaching) {
const expiresIn = 1000 * 300;
this.cache.set("sessionFlowOngoing", false, expiresIn);
}

// Internal hack: set to false to always refresh from hassession
this._enableSessionCaching = true;
this.cache.delete("sessionFlowOngoing");

// Old session
this._session = {};
Expand Down Expand Up @@ -544,7 +541,7 @@ export class Identity extends EventEmitter {
// for expiring session and safari browser do full page redirect to gain new session
if(_checkRedirectionNeed(sessionData)){
if (this._enableSessionCaching) {
const expiresIn = 1000 * 300;
const expiresIn = 1000 * (sessionData.expiresIn || 300);
this.cache.set("sessionFlowOngoing", true, expiresIn);
}

Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Automatically generated in 'npm version' by scripts/genversion.js

'use strict'
const version = '4.8.7-beta.6';
const version = '4.8.7-beta.7';
export default version;

0 comments on commit 3a1e87e

Please sign in to comment.