Skip to content

Commit

Permalink
don't wait revalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
pmi committed Sep 18, 2023
1 parent 3996814 commit 5075d37
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pages/api/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
}
return revalidatePath(res, cp);
});
await Promise.all(promises);
console.info(`Done revalidating everything`);
Promise.all(promises).then(() => {
console.info(`Done revalidating everything`);
}).catch((err) => {
console.info(`Revalidation error: ` + err);
});
} else {
await revalidatePath(res, path);
console.info(`Revalidated [${path}]`);
revalidatePath(res, path).then(() => {
console.info(`Revalidated [${path}]`);
}).catch((err) => {
console.info(`Revalidation error: ` + err);
});
}
// Return 200 after everything's revalidated
res.status(200).json({message: 'Revalidation started'});
Expand Down

1 comment on commit 5075d37

@vercel
Copy link

@vercel vercel bot commented on 5075d37 Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextjs-enonic-demo – ./

nextjs-enonic-demo.vercel.app
nextjs-enonic-demo-pmi1k.vercel.app
nextjs-enonic-demo-git-master-pmi1k.vercel.app

Please sign in to comment.