Clear glob cache entries when file paths change.

This commit is contained in:
Dillon Kearns 2021-05-17 17:15:04 -07:00
parent ddbafa19d7
commit 9585e41d9a
2 changed files with 5 additions and 0 deletions

View File

@ -151,6 +151,11 @@ async function start(options) {
Object.keys(global.staticHttpCache).forEach((dataSourceKey) => { Object.keys(global.staticHttpCache).forEach((dataSourceKey) => {
if (dataSourceKey.includes(`file://${changedPathRelative}`)) { if (dataSourceKey.includes(`file://${changedPathRelative}`)) {
delete global.staticHttpCache[dataSourceKey]; delete global.staticHttpCache[dataSourceKey];
} else if (
eventName === "add" ||
(eventName === "unlink" && dataSourceKey.startsWith("glob://"))
) {
delete global.staticHttpCache[dataSourceKey];
} }
}); });
clients.forEach((client) => { clients.forEach((client) => {