Skip to content

Commit

Permalink
Adjust message timeout between web and worker
Browse files Browse the repository at this point in the history
* The default message timeout is now 20 minutes, and the value is configurable using the
BOPTEST_MESSAGE_TIMEOUT environment variable.

* The service version is bumped to 0.4.2
  • Loading branch information
kbenne committed Sep 16, 2024
1 parent f6828c9 commit 247f794
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
- BOPTEST_REDIS_HOST
- BOPTEST_REGION
- BOPTEST_TIMEOUT
- BOPTEST_MESSAGE_TIMEOUT
- BOPTEST_DASHBOARD_SERVER
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
Expand Down
3 changes: 3 additions & 0 deletions test/test_testcase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def test_ibpsa_boptest_testcase():
response = requests.get(f"{host}/name/{testid}")
check.equal(response.status_code, 200)

response = requests.post(f"{host}/advance/{testid}")
check.equal(response.status_code, 200)

# Stop the test
response = requests.put(f"{host}/stop/{testid}")
check.equal(response.status_code, 200)
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1
0.4.2
12 changes: 10 additions & 2 deletions web/server/src/lib/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { pack, unpack } from 'msgpackr'
class Messaging {
constructor() {
this.subTimeoutTime = 600000
this.responseTimeoutTime = 480000
this.responseTimeoutTime = Number(
process.env.BOPTEST_MESSAGE_TIMEOUT
? process.env.BOPTEST_MESSAGE_TIMEOUT
: "1200000", // Default 20 minute message timeout
);

this.subscriptionTimers = {}
this.messageHandlers = {}
Expand Down Expand Up @@ -39,7 +43,11 @@ class Messaging {
this.subscribe(responseChannel)
this.sendWorkerMessage(requestChannel, requestID, method, params)
responseTimeout = setTimeout(() => {
reject(new Error(`Timeout while sending command '${method}' to testid '${workerID}'`))
reject(
new Error(
`Timeout for request: '${requestID}', with method:'${method}', sent to testid: '${workerID}'`,
),
);
}, this.responseTimeoutTime)
})
}
Expand Down

0 comments on commit 247f794

Please # to comment.