Skip to content

Commit

Permalink
feat(utils): 优化远程片段缓存读取
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Nov 26, 2019
1 parent c7bdc5e commit e8133f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,11 @@ export const loadRemoteSnippetList = (remoteSnippetList: ReadonlyArray<RemoteSni
return (async () => {
if (process.env.NOW_REGION) {
const tmp = tmpFactory(fileMd5, REMOTE_SNIPPET_CACHE_MAXAGE);
const tmpContent = await tmp.getContent();
let snippet;

if (await tmp.getContent()) {
snippet = await tmp.getContent();
if (tmpContent) {
snippet = tmpContent;
} else {
snippet = await load(item.url);
await tmp.setContent(snippet);
Expand Down

0 comments on commit e8133f5

Please sign in to comment.