refs #5576 perf: remove bad comments
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b2f569262a
commit
c1e245c2ea
|
@ -74,15 +74,12 @@ module.exports = Self => {
|
||||||
Self.createLink = async(parent, child = null) => {
|
Self.createLink = async(parent, child = null) => {
|
||||||
try {
|
try {
|
||||||
const exists = await fs.exists(parent);
|
const exists = await fs.exists(parent);
|
||||||
if (exists)
|
exists && await fs.unlink(parent);
|
||||||
await fs.unlink(parent);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await fs.symlink(child, parent);
|
await fs.symlink(child, parent);
|
||||||
const link = await fs.readlink(parent);
|
|
||||||
console.log(link);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
|
@ -96,17 +93,16 @@ module.exports = Self => {
|
||||||
}) {
|
}) {
|
||||||
const {name, dstDir} = await Self.handleFolderDestination(fileName);
|
const {name, dstDir} = await Self.handleFolderDestination(fileName);
|
||||||
try {
|
try {
|
||||||
await models.Image.upsertWithWhere({
|
const baseUpsert = {
|
||||||
name,
|
name,
|
||||||
collectionFk: collectionName,
|
collectionFk: collectionName,
|
||||||
},
|
};
|
||||||
|
await models.Image.upsertWithWhere(baseUpsert,
|
||||||
{
|
{
|
||||||
name,
|
...baseUpsert,
|
||||||
collectionFk: collectionName,
|
|
||||||
updated: Date.vnNow() / 1000,
|
updated: Date.vnNow() / 1000,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugger;
|
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
const collection = await Self.getCollection(collectionName);
|
const collection = await Self.getCollection(collectionName);
|
||||||
|
@ -130,7 +126,6 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
await fs.mkdir(fullSizePath, {recursive: true});
|
await fs.mkdir(fullSizePath, {recursive: true});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugger;
|
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
const gmInstance = gm(srcFile);
|
const gmInstance = gm(srcFile);
|
||||||
|
@ -138,7 +133,7 @@ module.exports = Self => {
|
||||||
let fileHeight = null;
|
let fileHeight = null;
|
||||||
|
|
||||||
gmInstance.size(function(err, size) {
|
gmInstance.size(function(err, size) {
|
||||||
if (err) console.error(err);
|
if (err) throw new Error(err);
|
||||||
[fileWidth, fileHeight] = parseSize(size);
|
[fileWidth, fileHeight] = parseSize(size);
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
@ -153,23 +148,10 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugger;
|
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Self.createLink(toFullSizeOriginalPath, toFullSizePath);
|
await Self.createLink(toFullSizeOriginalPath, toFullSizePath);
|
||||||
/* try {
|
|
||||||
await fs.unlink(toFullSizeOriginalPath);
|
|
||||||
} catch (e) {
|
|
||||||
debugger;
|
|
||||||
throw new Error(e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await fs.symlink(toFullSizeOriginalPath, toFullSizePath, 'file');
|
|
||||||
} catch (e) {
|
|
||||||
debugger;
|
|
||||||
throw new Error(e);
|
|
||||||
}*/
|
|
||||||
// To collection sizes
|
// To collection sizes
|
||||||
for (const size of collection.sizes()) {
|
for (const size of collection.sizes()) {
|
||||||
const [width, height] = parseSize(size);
|
const [width, height] = parseSize(size);
|
||||||
|
@ -182,7 +164,6 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
await fs.mkdir(sizePath, {recursive: true});
|
await fs.mkdir(sizePath, {recursive: true});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugger;
|
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +197,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
const toSizeOriginalPath = `${sizeOriginalPath}/${fileName}`;
|
const toSizeOriginalPath = `${sizeOriginalPath}/${fileName}`;
|
||||||
|
|
||||||
// if (fileWidth > width && fileHeight < height)
|
|
||||||
await Self.createLink(toSizeOriginalPath, toSizePath);
|
await Self.createLink(toSizeOriginalPath, toSizePath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue