Added clearInterval()
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8968f41b75
commit
1ef6637ad3
|
@ -27,12 +27,15 @@ module.exports = Self => {
|
|||
// Create temporary path
|
||||
await fs.mkdir(tempPath, {recursive: true});
|
||||
|
||||
setInterval(async() => {
|
||||
const timer = setInterval(async() => {
|
||||
const image = await Self.findOne({where: {error: null}});
|
||||
const fileName = `${image.itemFk}.png`;
|
||||
const filePath = path.join(tempPath, fileName);
|
||||
const file = fs.createWriteStream(filePath);
|
||||
|
||||
// Exit loop
|
||||
if (!image) clearInterval(timer);
|
||||
|
||||
const file = fs.createWriteStream(filePath);
|
||||
https.get(image.url, async response => {
|
||||
if (response.statusCode != 200) {
|
||||
const error = new Error(`Could not download the image. Status code ${response.statusCode}`);
|
||||
|
|
Loading…
Reference in New Issue