Skip to content

Commit a783f21

Browse files
committed
chore: comments
1 parent cb97ea5 commit a783f21

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

bin/testObservability/helper/cleanupQueueSync.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Sending all the remaining queues for synchronous manner
3+
*/
4+
15
const RequestQueueHandler = require('./requestQueueHandler');
26

37
const shutdown = async () => {

bin/testObservability/helper/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ exports.TEST_OBSERVABILITY_REPORTER = 'browserstack-cypress-cli/bin/testObservab
3333

3434
exports.TEST_OBSERVABILITY_REPORTER_LOCAL = path.join(__dirname, '..', 'reporter');
3535

36-
exports.PENDING_QUEUS_FILE = 'pending_queus.json';
36+
exports.PENDING_QUEUS_FILE = `pending_queus_${process.pid}.json`;

bin/testObservability/helper/requestQueueHandler.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fs = require('fs');
22
const cp = require('child_process');
3+
const path = require('path');
34

45
const { BATCH_SIZE, BATCH_INTERVAL, consoleHolder, PENDING_QUEUS_FILE } = require('./constants');
56
const { debug, batchAndPostEvents } = require('./helper');
@@ -54,9 +55,9 @@ class RequestQueueHandler {
5455
shutdownSync = () => {
5556
this.removeEventBatchPolling('REMOVING');
5657

57-
fs.writeFileSync(require('path').join(__dirname, PENDING_QUEUS_FILE), JSON.stringify(this.queue));
58+
fs.writeFileSync(path.join(__dirname, PENDING_QUEUS_FILE), JSON.stringify(this.queue));
5859
this.queue = [];
59-
cp.spawnSync('node', [require('path').join(__dirname, 'cleanupQueueSync.js'), require('path').join(__dirname, PENDING_QUEUS_FILE)], {stdio: 'inherit'});
60+
cp.spawnSync('node', [path.join(__dirname, 'cleanupQueueSync.js'), path.join(__dirname, PENDING_QUEUS_FILE)], {stdio: 'inherit'});
6061
}
6162

6263
shutdown = async () => {

bin/testObservability/plugin/ipcServer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ exports.startIPCServer = (subscribeServerEvents, unsubscribeServerEvents) => {
2727
process.on('exit', () => {
2828
unsubscribeServerEvents(ipc.server);
2929
ipc.server.stop();
30+
// Cleaning up all remaining event in request queue handler. Any synchronous operations
31+
// on exit handler will block the process
3032
requestQueueHandler.shutdownSync();
3133
});
3234

0 commit comments

Comments
 (0)