Skip to content

Commit 8c97da1

Browse files
committed
Add support for async serializer so it can be used with worker threads
1 parent f390403 commit 8c97da1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface NormalizedRedisClient {
1212
}
1313

1414
interface Serializer {
15-
parse(s: string): SessionData
15+
parse(s: string): SessionData | Promise<SessionData>
1616
stringify(s: SessionData): string
1717
}
1818

@@ -83,7 +83,7 @@ class RedisStore extends Store {
8383
try {
8484
let data = await this.client.get(key)
8585
if (!data) return cb()
86-
return cb(null, this.serializer.parse(data))
86+
return cb(null, await this.serializer.parse(data))
8787
} catch (err) {
8888
return cb(err)
8989
}

0 commit comments

Comments
 (0)