Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Commit fcf1e44

Browse files
author
Michel Ribeiro
committed
fix: Call version cache config property by cacheVersion
1 parent cd803d0 commit fcf1e44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/target/typescript_nodeserver.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ END
136136
@io << ident ident "let cacheKey: string | null = null, decodedKey: string | null = null, cacheExpirationSeconds: number | null = null, cacheVersion: number | null = null;\n"
137137
@io << ident ident "if (cacheConfig.#{op.pretty_name}) {\n"
138138
@io << ident ident ident "try {\n"
139-
@io << ident ident ident ident "const {key, expirationSeconds, version} = await cacheConfig.#{op.pretty_name}(#{(["ctx"] + op.args.map(&.name)).join(", ")});\n"
139+
@io << ident ident ident ident "const {key, expirationSeconds, version: cacheVersion} = await cacheConfig.#{op.pretty_name}(#{(["ctx"] + op.args.map(&.name)).join(", ")});\n"
140140
@io << ident ident ident ident "if (!key) throw \"\";\n"
141-
@io << ident ident ident ident "cacheKey = crypto.createHash(\"sha256\").update(JSON.stringify(key)+ \"-#{op.pretty_name}\").digest(\"hex\").substr(0, 100); decodedKey = JSON.stringify(key); cacheExpirationSeconds = expirationSeconds; cacheVersion = version;\n"
142-
@io << ident ident ident ident "const cache = await hook.getCache(cacheKey, version);console.log(JSON.stringify(cache));\n"
141+
@io << ident ident ident ident "cacheKey = crypto.createHash(\"sha256\").update(JSON.stringify(key)+ \"-#{op.pretty_name}\").digest(\"hex\").substr(0, 100); decodedKey = JSON.stringify(key); cacheExpirationSeconds = expirationSeconds;\n"
142+
@io << ident ident ident ident "const cache = await hook.getCache(cacheKey, cacheVersion);console.log(JSON.stringify(cache));\n"
143143
@io << ident ident ident ident "if (cache && (!cache.expirationDate || cache.expirationDate > new Date())) return cache.ret;\n"
144144
@io << ident ident ident "} catch(e) {console.log(JSON.stringify(e));}\n"
145145
@io << ident ident "}\n"

0 commit comments

Comments
 (0)