Skip to content

Commit

Permalink
repo sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Octomerger authored Oct 22, 2020
2 parents 16bb1aa + 3600e4d commit 9977f31
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions middleware/render-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ module.exports = async function renderPage (req, res, next) {
const originalUrl = req.originalUrl

// Serve from the cache if possible
if (req.method === 'GET' && pageCache[originalUrl]) {
console.log(`Serving from cached version of ${originalUrl}`)
return res.send(pageCache[originalUrl])
if (!process.env.CI) {
if (req.method === 'GET' && pageCache[originalUrl]) {
console.log(`Serving from cached version of ${originalUrl}`)
return res.send(pageCache[originalUrl])
}
}

// render a 404 page
Expand Down Expand Up @@ -86,8 +88,10 @@ module.exports = async function renderPage (req, res, next) {
const output = await liquid.parseAndRender(layout, context)

// Save output to cache for the next time around
if (req.method === 'GET') {
pageCache[originalUrl] = output
if (!process.env.CI) {
if (req.method === 'GET') {
pageCache[originalUrl] = output
}
}

// send response
Expand Down

0 comments on commit 9977f31

Please sign in to comment.