Skip to content

Commit cb97ea5

Browse files
committed
chore: comments
1 parent e75edc7 commit cb97ea5

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

bin/testObservability/helper/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ exports.OBSERVABILITY_ENV_VARS = [
3232
exports.TEST_OBSERVABILITY_REPORTER = 'browserstack-cypress-cli/bin/testObservability/reporter';
3333

3434
exports.TEST_OBSERVABILITY_REPORTER_LOCAL = path.join(__dirname, '..', 'reporter');
35+
36+
exports.PENDING_QUEUS_FILE = 'pending_queus.json';

bin/testObservability/helper/helper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ exports.pending_test_uploads = {
4141
};
4242

4343
exports.debug = (text, shouldReport = false, throwable = null) => {
44-
consoleHolder.log(`[ OBSERVABILITY ] ${text}`);
4544
if (process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "true" || process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "1") {
4645
logger.info(`[ OBSERVABILITY ] ${text}`);
4746
}
@@ -397,7 +396,6 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
397396
exports.debug('Build creation successfull!');
398397
process.env.BS_TESTOPS_BUILD_COMPLETED = true;
399398
setEnvironmentVariablesForRemoteReporter(response.data.jwt, response.data.build_hashed_id, response.data.allow_screenshots, data.observability_version.sdkVersion);
400-
consoleHolder.log(response.data.build_hashed_id);
401399
if(this.isBrowserstackInfra()) helper.setBrowserstackCypressCliDependency(user_config);
402400
} catch(error) {
403401
if(!error.errorType) {

bin/testObservability/helper/requestQueueHandler.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const { BATCH_SIZE, BATCH_INTERVAL, consoleHolder } = require('./constants');
1+
const fs = require('fs');
2+
const cp = require('child_process');
3+
4+
const { BATCH_SIZE, BATCH_INTERVAL, consoleHolder, PENDING_QUEUS_FILE } = require('./constants');
25
const { debug, batchAndPostEvents } = require('./helper');
36

47
class RequestQueueHandler {
@@ -51,17 +54,16 @@ class RequestQueueHandler {
5154
shutdownSync = () => {
5255
this.removeEventBatchPolling('REMOVING');
5356

54-
require('fs').writeFileSync(require('path').join(__dirname, 'queue.json'), JSON.stringify(this.queue));
57+
fs.writeFileSync(require('path').join(__dirname, PENDING_QUEUS_FILE), JSON.stringify(this.queue));
5558
this.queue = [];
56-
require('child_process').spawnSync('node', [require('path').join(__dirname, 'shutdown.js'), require('path').join(__dirname, 'queue.json')], {stdio: 'inherit'});
59+
cp.spawnSync('node', [require('path').join(__dirname, 'cleanupQueueSync.js'), require('path').join(__dirname, PENDING_QUEUS_FILE)], {stdio: 'inherit'});
5760
}
5861

5962
shutdown = async () => {
6063
this.removeEventBatchPolling('REMOVING');
6164
while(this.queue.length > 0) {
6265
const data = this.queue.slice(0,BATCH_SIZE);
6366
this.queue.splice(0,BATCH_SIZE);
64-
consoleHolder.log(this.queue.length + " the queue length ");
6567
await batchAndPostEvents(this.eventUrl,'Shutdown-Queue',data);
6668
}
6769
}

0 commit comments

Comments
 (0)