Skip to content

Commit 3665f83

Browse files
committed
feat: Don't allow negative values for expiresIn
1 parent c9d4bca commit 3665f83

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/connect-dynamodb.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ module.exports = function (connect) {
6868
if (this.reapInterval > 0) {
6969
this._reap = setInterval(this.reap.bind(this), this.reapInterval);
7070
}
71-
this.expiresIn = null == options.expiresIn ? 0 : options.expiresIn
71+
this.expiresIn = null == options.expiresIn ? 0 : Math.max(options.expiresIn, 0)
72+
if (options.expiresIn && options.expiresIn < 0) {
73+
console.warn("Negative `expiresIn` values are not supported. Reverting to default behaviour")
74+
}
7275
}
7376

7477
/*

0 commit comments

Comments
 (0)