Skip to content

Commit

Permalink
docs(academy): Fix code example (#544)
Browse files Browse the repository at this point in the history
If the cache exists and is not expired, then we skip updating. Right?

---------

Co-authored-by: Martin Adámek <[email protected]>
  • Loading branch information
Lou1sL and B4nan authored Jul 31, 2023
1 parent 4fe59d9 commit e852476
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ page.on('response', async (response) => {
const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
const maxAge = maxAgeMatch && maxAgeMatch.length > 1 ? parseInt(maxAgeMatch[1], 10) : 0;
if (maxAge) {
if (!cache[url] || cache[url].expires > Date.now()) return;
if (cache[url] && cache[url].expires > Date.now()) return;

let buffer;
try {
Expand Down

0 comments on commit e852476

Please sign in to comment.