Commit 133af8f5 authored by Пискунов Андрей Дмитриевич's avatar Пискунов Андрей Дмитриевич
Browse files

:sparkles: add timeout running

parent ff4b4566
No related merge requests found
Showing with 9 additions and 4 deletions
+9 -4
GITLAB_TOKEN= GITLAB_TOKEN=
GITLAB_HOST= GITLAB_HOST=
\ No newline at end of file TIMEOUT=
\ No newline at end of file
...@@ -4,4 +4,5 @@ require('dotenv').config({ path: path.join(__dirname, '../.env') }) ...@@ -4,4 +4,5 @@ require('dotenv').config({ path: path.join(__dirname, '../.env') })
module.exports = { module.exports = {
gitlabToken: process.env.GITLAB_TOKEN, gitlabToken: process.env.GITLAB_TOKEN,
gitlabHost: process.env.GITLAB_HOST, gitlabHost: process.env.GITLAB_HOST,
timeout: parseInt(process.env.TIMEOUT, 10) || 300000
}; };
...@@ -26,7 +26,7 @@ const api = new Gitlab({ ...@@ -26,7 +26,7 @@ const api = new Gitlab({
function readStudentsFile() { function readStudentsFile() {
if (!fs.existsSync(studentsFilePath)) { if (!fs.existsSync(studentsFilePath)) {
console.error(`File ${studentsFilePath} doesn't exist`); console.log(`File ${studentsFilePath} doesn't exist`);
return []; return [];
} }
const data = fs.readFileSync(studentsFilePath, 'utf8'); const data = fs.readFileSync(studentsFilePath, 'utf8');
...@@ -88,9 +88,12 @@ async function main() { ...@@ -88,9 +88,12 @@ async function main() {
await addUserToProject(user.id, project.id); await addUserToProject(user.id, project.id);
} catch(err) { } catch(err) {
console.error(err); console.log(err);
} }
} }
} }
main().catch(err => console.error(err));
setInterval(() => {
main().catch(err => console.log(err));
}, config.timeout);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment