koajs/koa-redis

bug:ttl from mills to seconds

whosesmile opened this issue · 0 comments

I use koa-generic-session which is dependence this project, and I found a bug in koa-generic-session,

// if has cookie.expires, ignore cookie.maxage
    if (sess.cookie && sess.cookie.expires) {
      ttl = Math.ceil(sess.cookie.expires.getTime() - Date.now());
}

and in this project:

if (typeof ttl === 'number') {
    ttl = ttl / 1000;
  }

got a float number not a integer, then a error will be traced:

 ERR value is not an integer or out of range

Maybe:

ttl = parseInt(ttl/1000, 10)?