(sid: string, sess:any)
| 219 | // would behave like set() in that case but it's OK if it doesn't -- express-session will call |
| 220 | // set() soon enough. |
| 221 | async _touch(sid: string, sess:any) { |
| 222 | logger.debug(`TOUCH ${sid}`); |
| 223 | sess = await this._updateExpirations(sid, sess, false); |
| 224 | if (sess == null) return; // Already expired. |
| 225 | const exp = this._expirations.get(sid); |
| 226 | // If the session doesn't expire, don't do anything. Ideally we would write the session to the |
| 227 | // database if it didn't already exist, but we have no way of knowing that without querying the |
| 228 | // database. The query overhead is not worth it because set() should be called soon anyway. |
| 229 | if (exp == null) return; |
| 230 | if (exp.db != null && (this._refresh == null || exp.real < exp.db + this._refresh)) return; |
| 231 | await this._write(sid, sess); |
| 232 | exp.db = new Date(sess.cookie.expires).getTime(); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | // express-session doesn't support Promise-based methods. This is where the callbackified versions |
nothing calls this directly
no test coverage detected