@jcbuisson/express-x 1.7.4 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.mjs +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
package/src/server.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  import http from 'http'
3
3
  import { Server } from "socket.io"
4
4
  import express from 'express'
5
+ import config from 'config'
5
6
 
6
7
  /*
7
8
  * Enhance `app` express application with services and real-time features
@@ -45,7 +46,7 @@ export function expressX(prisma, options = {}) {
45
46
  try {
46
47
  await prisma.Connection.delete({ where: { id }})
47
48
  } catch(err) {
48
- // it may be necessary in rare situations (not sure...)
49
+ // in case it would no longer exist
49
50
  }
50
51
  }
51
52
 
@@ -334,7 +335,7 @@ export function expressX(prisma, options = {}) {
334
335
  socket.on('disconnect', () => {
335
336
  app.log('verbose', `Client disconnected ${connection.id}`)
336
337
 
337
- // remove connection record after 1mn (leaves time in case of connection transfer)
338
+ // remove connection record after expiration delay, if it still exists
338
339
  setTimeout(async () => {
339
340
  const connectionId = connection.id
340
341
  // check if connection still exists
@@ -343,7 +344,7 @@ export function expressX(prisma, options = {}) {
343
344
  app.log('verbose', `Delete connection ${connectionId}`)
344
345
  await deleteConnection(connectionId)
345
346
  }
346
- }, 10 * 1000)
347
+ }, config.SESSION_EXPIRE_DELAY || 24*60*60000)
347
348
  })
348
349
 
349
350