Skip to content

Commit

Permalink
pretty print and added sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkasey committed Aug 20, 2022
1 parent ac98e92 commit 6499e96
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const main = async () => {
},
headers: {"Authorization": `cpanel ${cpanel_username}:${cpanel_token}`}
});
console.log(`updateRes: ${updateRes}`);
console.log(`updateRes: ${JSON.stringify(updateRes, null, 2)}`);
updateRes = updateRes.data;
if (updateRes.errors !== null) {
// noinspection ExceptionCaughtLocallyJS
Expand All @@ -43,7 +43,7 @@ const main = async () => {
startDeployRes = startDeployRes.data;
if (startDeployRes.errors !== null) {
// noinspection ExceptionCaughtLocallyJS
throw new Error("Failed to start deployment task: " + JSON.stringify(startDeployRes.errors));
throw new Error("Failed to start deployment task: " + JSON.stringify(startDeployRes.errors, null, 2));
}
const taskId = startDeployRes.task_id;
if (!taskId) {
Expand Down Expand Up @@ -72,6 +72,9 @@ const main = async () => {
// noinspection ExceptionCaughtLocallyJS
throw new Error(`Task failed to deploy. errors: ${pollRes.errors}`);
}
//not failed nor success - wait
console.log(`task ${taskId} still running. taskData: ${taskData}`);
await new Promise(r => setTimeout(r, 1000));
}

const duration = new Date() - timeStart;
Expand Down

0 comments on commit 6499e96

Please sign in to comment.