Queue changes
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a10e091b62
commit
8968f41b75
|
@ -20,7 +20,6 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const imageQueue = await Self.find({where: {error: null}, limit: 25});
|
|
||||||
/* const tempPath = path.join('/tmp/salix-image'); */
|
/* const tempPath = path.join('/tmp/salix-image'); */
|
||||||
const rootPath = models.Image.getPath();
|
const rootPath = models.Image.getPath();
|
||||||
const tempPath = path.join(rootPath, 'temp');
|
const tempPath = path.join(rootPath, 'temp');
|
||||||
|
@ -28,7 +27,8 @@ module.exports = Self => {
|
||||||
// Create temporary path
|
// Create temporary path
|
||||||
await fs.mkdir(tempPath, {recursive: true});
|
await fs.mkdir(tempPath, {recursive: true});
|
||||||
|
|
||||||
for (let image of imageQueue) {
|
setInterval(async() => {
|
||||||
|
const image = await Self.findOne({where: {error: null}});
|
||||||
const fileName = `${image.itemFk}.png`;
|
const fileName = `${image.itemFk}.png`;
|
||||||
const filePath = path.join(tempPath, fileName);
|
const filePath = path.join(tempPath, fileName);
|
||||||
const file = fs.createWriteStream(filePath);
|
const file = fs.createWriteStream(filePath);
|
||||||
|
@ -58,7 +58,7 @@ module.exports = Self => {
|
||||||
}).on('error', async error => {
|
}).on('error', async error => {
|
||||||
await errorHandler(image.itemFk, error, filePath);
|
await errorHandler(image.itemFk, error, filePath);
|
||||||
});
|
});
|
||||||
}
|
}, 500);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await errorHandler(image.itemFk, error);
|
await errorHandler(image.itemFk, error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue