Mrtenz / typeorm-store

A TypeORM-based store for express-session.
MIT License
16 stars 12 forks source link

expirationInterval is defined in milliseconds, not seconds #7

Closed RoccoC closed 3 years ago

RoccoC commented 3 years ago

The expirationInterval doc comment says:

The interval between checking for expired sessions in seconds. Defaults to 86400 (1 day).

But, the value is actually passed as-is to node's setInterval function, without first multiplying by 1000 (https://github.com/Mrtenz/typeorm-store/blob/master/src/store.ts#L189):

this.expirationIntervalId = setInterval(this.clearExpiredSessions, interval);

This means clearExpiredSessions() is getting called 1000x more times than would be expected given the documentation. :)

RoccoC commented 3 years ago

Just realized there's already a PR to fix this one: https://github.com/Mrtenz/typeorm-store/pull/4

Mrtenz commented 3 years ago

Thanks for the reminder! The fix was merged and deployed to npm.