Skip to content

Commit

Permalink
Add support for async serializer so it can be used with worker threads
Browse files Browse the repository at this point in the history
  • Loading branch information
ozcanovunc committed Apr 26, 2023
1 parent f390403 commit 8c97da1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface NormalizedRedisClient {
}

interface Serializer {
parse(s: string): SessionData
parse(s: string): SessionData | Promise<SessionData>
stringify(s: SessionData): string
}

Expand Down Expand Up @@ -83,7 +83,7 @@ class RedisStore extends Store {
try {
let data = await this.client.get(key)
if (!data) return cb()
return cb(null, this.serializer.parse(data))
return cb(null, await this.serializer.parse(data))
} catch (err) {
return cb(err)
}
Expand Down

0 comments on commit 8c97da1

Please sign in to comment.