Compare commits
3 Commits
b23a0768e3
...
#17-lintin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
911142a8aa | ||
| 0ff11589e9 | |||
| a2abe7e71d |
28
gitea/workflows/DRBv3_linting.yaml
Normal file
28
gitea/workflows/DRBv3_linting.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Lint JavaScript/Node.js
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
lint-js:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22' # Use your preferred Node.js version
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Lint JavaScript/Node.js
|
||||
run: npm run lint
|
||||
@@ -11,6 +11,9 @@ dotenv.config();
|
||||
let currentSystem = undefined;
|
||||
let crashDetectionInterval; // Variable to store the crash detection interval ID
|
||||
|
||||
// Sleep utility to add delays between retries
|
||||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
/**
|
||||
* Checks the health of the OP25 web portal by making an HTTP HEAD request.
|
||||
* If the portal does not respond or there is an issue, retries a specified number of times.
|
||||
@@ -25,7 +28,7 @@ const checkServiceHealth = async () => {
|
||||
try {
|
||||
log.INFO("Checking OP25 web portal health...");
|
||||
// Perform an HTTP HEAD request to the web portal with a 5-second timeout
|
||||
await axios.head('http://localhost:8081', { timeout: 5000 });
|
||||
await axios({ method: "get", url: 'http://localhost:8081', timeout: 5000 });
|
||||
log.INFO("Web portal is healthy.");
|
||||
} catch (error) {
|
||||
if (error.code === 'ECONNABORTED') {
|
||||
@@ -40,10 +43,13 @@ const checkServiceHealth = async () => {
|
||||
|
||||
// Retry mechanism
|
||||
const retryAttempts = 3;
|
||||
const delayBetweenRetries = 3000; // 3 seconds delay
|
||||
|
||||
for (let i = 1; i <= retryAttempts; i++) {
|
||||
log.INFO(`Retrying to check web portal health... Attempt ${i}/${retryAttempts}`);
|
||||
try {
|
||||
await axios.head('http://localhost:8081', { timeout: 5000 });
|
||||
await sleep(delayBetweenRetries); // Add delay before retrying
|
||||
await axios({ method: "get", url: 'http://localhost:8081', timeout: 5000 });
|
||||
log.INFO("Web portal is healthy on retry.");
|
||||
return;
|
||||
} catch (retryError) {
|
||||
|
||||
Reference in New Issue
Block a user