Skip to content

Commit

Permalink
Merge pull request #2399 from alphagov/fix-non-expired-session-cleanup
Browse files Browse the repository at this point in the history
Stop accidentally cleaning up non-expired sessions
  • Loading branch information
36degrees authored Feb 28, 2024
2 parents dcf4429 + 66b4cfe commit 75f9623
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/session-file-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ class FileStore extends Store {
}

async set (sessionId, session, callback = noop) {
let storedSessionId
try {
// Delete any expired sessions before creating a new session
const storedSessionFiles = await fse.readdir(this.path)
await Promise.all(storedSessionFiles.map(async sessionFile => {
storedSessionId = sessionFile.replace('.json', '')
const storedSessionId = sessionFile.replace('.json', '')
try {
const storedSession = await fse.readJson(path.join(this.path, sessionFile))
if (isExpired(storedSession)) {
Expand Down

0 comments on commit 75f9623

Please sign in to comment.