mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-02-07 10:16:16 +00:00
Skip cache if a task is a copy or says to skip cache
This commit is contained in:
parent
e95f2cf3db
commit
4751c8f215
@ -85,6 +85,11 @@ module.exports = exports = class Manifest {
|
|||||||
mode: 'new',
|
mode: 'new',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (task.nocache) {
|
||||||
|
result.mode = 'silent';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
const [ iTime, oTime, cTime, iRev ] = await Promise.all([
|
const [ iTime, oTime, cTime, iRev ] = await Promise.all([
|
||||||
local && this.stat(input),
|
local && this.stat(input),
|
||||||
this.stat(output),
|
this.stat(output),
|
||||||
@ -129,6 +134,9 @@ module.exports = exports = class Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async touch (task, lastSeen = new Date()) {
|
async touch (task, lastSeen = new Date()) {
|
||||||
|
|
||||||
|
if (task.nocache || task.action.name) return null;
|
||||||
|
|
||||||
const hash = this.hash(task);
|
const hash = this.hash(task);
|
||||||
const { input, output } = task;
|
const { input, output } = task;
|
||||||
const local = !task.input.includes('://');
|
const local = !task.input.includes('://');
|
||||||
@ -159,6 +167,7 @@ module.exports = exports = class Manifest {
|
|||||||
async set (task, result, lastSeen = new Date()) {
|
async set (task, result, lastSeen = new Date()) {
|
||||||
const hash = this.hash(task);
|
const hash = this.hash(task);
|
||||||
const { input, output } = task;
|
const { input, output } = task;
|
||||||
|
const nocache = task.nocache || task.action.name === 'copy';
|
||||||
const ext = path.extname(task.output);
|
const ext = path.extname(task.output);
|
||||||
const local = !task.input.includes('://');
|
const local = !task.input.includes('://');
|
||||||
const cached = path.join(CACHE, hash + ext);
|
const cached = path.join(CACHE, hash + ext);
|
||||||
@ -167,7 +176,7 @@ module.exports = exports = class Manifest {
|
|||||||
const [ iTime, iRev ] = await Promise.all([
|
const [ iTime, iRev ] = await Promise.all([
|
||||||
local && this.stat(input),
|
local && this.stat(input),
|
||||||
local && this.compareBy.inputRev && this.revFile(input),
|
local && this.compareBy.inputRev && this.revFile(input),
|
||||||
result && fs.writeFile(resolve(cached), result),
|
result && !nocache && fs.writeFile(resolve(cached), result),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const record = {
|
const record = {
|
||||||
@ -184,8 +193,10 @@ module.exports = exports = class Manifest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.revManifest[output] = record.revPath;
|
this.revManifest[output] = record.revPath;
|
||||||
|
if (!nocache) {
|
||||||
this.manifest[hash] = record;
|
this.manifest[hash] = record;
|
||||||
await this.writeManifest();
|
await this.writeManifest();
|
||||||
|
}
|
||||||
return { ...record };
|
return { ...record };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ const LOG = {
|
|||||||
rebuild: true,
|
rebuild: true,
|
||||||
cached: false,
|
cached: false,
|
||||||
copy: false,
|
copy: false,
|
||||||
|
silent: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = exports = async function process (tasks, cache) {
|
module.exports = exports = async function process (tasks, cache) {
|
||||||
|
@ -70,6 +70,7 @@ module.exports = exports = class File {
|
|||||||
input: this.input,
|
input: this.input,
|
||||||
output: this.out,
|
output: this.out,
|
||||||
action: actions.copy,
|
action: actions.copy,
|
||||||
|
nocache: true,
|
||||||
} ];
|
} ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ module.exports = exports = async function svgIcons () {
|
|||||||
input: f,
|
input: f,
|
||||||
output: 'images/' + f,
|
output: 'images/' + f,
|
||||||
action: actions.copy,
|
action: actions.copy,
|
||||||
|
nocache: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return tasks;
|
return tasks;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user