Skip to content

Commit

Permalink
🚀 Deploy new version [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
pabio-escobar committed Feb 21, 2022
1 parent e319528 commit 004ea6f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 48 deletions.
53 changes: 30 additions & 23 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166100,48 +166100,55 @@ const update = async (shouldCommit = false) => {
}
else if (site.check === "ws") {
console.log("Using websocket check instead of curl");
try {
setTimeout(() => {
let status = "up";
let success = false;
let status = "up";
let responseTime = "0";
// promise to await:
const connect = () => {
return new Promise(function (resolve, reject) {
const ws = new ws_1.default((0, environment_1.replaceEnvironmentVariables)(site.url));
let success = false;
let responseTime = "0";
ws.on('open', function open() {
if (site.body) {
ws.send(site.body);
}
else {
ws.send("");
}
ws.on('message', function message(data) {
if (data) {
success = true;
}
});
ws.close();
});
ws.on('message', function message(data) {
if (data) {
success = true;
}
ws.on('close', function close() {
console.log('Websocket disconnected');
});
resolve(ws);
});
ws.on('error', function error(error) {
throw error;
});
ws.on('close', function close() {
console.log('Websocket disconnected');
reject(error);
});
if (success) {
status = "up";
}
else {
status = "down";
}
;
}, site.maxResponseTime);
});
};
try {
const connection = await connect();
if (connection)
success = true;
if (success) {
status = "up";
}
else {
status = "down";
}
;
return {
result: { httpCode: 200 },
responseTime,
status,
};
}
catch (error) {
console.log("ERROR Got pinging error", error);
console.log("ERROR Got pinging error from async call", error);
return { result: { httpCode: 0 }, responseTime: (0).toFixed(0), status: "down" };
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

53 changes: 30 additions & 23 deletions dist/update.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 004ea6f

Please sign in to comment.