Skip to content

Commit 12ce0a7

Browse files
authored
Chore/removing retrying for lobby wait (#34)
* Chore: remove retry logic for lobby wait errors and update configuration parameters
1 parent a1fc28d commit 12ce0a7

File tree

8 files changed

+33
-17
lines changed

8 files changed

+33
-17
lines changed

.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ AUTH_BASE_URL_V2=http://host.docker.internal:8081/v2
33

44
# Meeting recording configuration
55
MAX_RECORDING_DURATION_MINUTES=180
6-
MEETING_INACTIVITY_MINUTES=15
6+
# Silence detection timeout in minutes (how long to wait before ending due to inactivity)
7+
MEETING_INACTIVITY_MINUTES=2
78
INACTIVITY_DETECTION_START_DELAY_MINUTES=5
9+
# How long to wait at lobby before timing out (in minutes)
10+
JOIN_WAIT_TIME_MINUTES=2
11+
# Number of retries for transient errors (WaitingAtLobbyRetryError never retries)
12+
# RETRY_COUNT=2 means: 1 initial attempt + 2 retries = 3 total attempts
13+
RETRY_COUNT=2
814

915
# GCP bucket configuration for uploading debugging screenshots
1016
GCP_ACCESS_KEY_ID=

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meeting-bot",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Run meeting bots for Google Meet, Microsoft Teams and Zoom",
55
"main": "index.js",
66
"license": "MIT",

src/app/common.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Logger } from 'winston';
2-
import { KnownError } from '../error';
2+
import { KnownError, WaitingAtLobbyRetryError } from '../error';
33
import { getErrorType } from '../util/logger';
4+
import config from '../config';
45

56
export interface MeetingJoinParams {
67
url: string;
@@ -45,6 +46,12 @@ export const joinMeetWithRetry = async (
4546
timezone,
4647
});
4748
} catch (error) {
49+
// Never retry WaitingAtLobbyRetryError - if user doesn't admit bot, retrying won't help
50+
if (error instanceof WaitingAtLobbyRetryError) {
51+
logger.error('WaitingAtLobbyRetryError - not retrying:', error.message);
52+
throw error;
53+
}
54+
4855
if (error instanceof KnownError && !error.retryable) {
4956
logger.error('KnownError is not retryable:', error.name, error.message);
5057
throw error;
@@ -57,9 +64,9 @@ export const joinMeetWithRetry = async (
5764

5865
retryCount += 1;
5966
await sleep(retryCount * 30000);
60-
if (retryCount < 3) {
67+
if (retryCount <= config.retryCount) {
6168
if (retryCount) {
62-
logger.warn(`Retry count: ${retryCount}`);
69+
logger.warn(`Retry attempt: ${retryCount}/${config.retryCount}`);
6370
}
6471
await joinMeetWithRetry(processor, bearerToken, url, name, teamId, timezone, userId, retryCount, eventId, botId, logger);
6572
} else {

src/bots/GoogleMeetBot.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ export class GoogleMeetBot extends MeetBotBase {
344344

345345
this._logger.error('Cant finish wait at the lobby check', { userDenied, waitingAtLobbySuccess, bodyText });
346346

347-
throw new WaitingAtLobbyRetryError('Google Meet bot could not enter the meeting...', bodyText ?? '', !userDenied, 2);
347+
// Don't retry lobby errors - if user doesn't admit bot, retrying won't help
348+
throw new WaitingAtLobbyRetryError('Google Meet bot could not enter the meeting...', bodyText ?? '', false, 0);
348349
}
349350
} catch(lobbyError) {
350351
this._logger.info('Closing the browser on error...', lobbyError);

src/bots/MicrosoftTeamsBot.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ export class MicrosoftTeamsBot extends MeetBotBase {
306306

307307
this._logger.error('Closing the browser on error...', error);
308308
await this.page.context().browser()?.close();
309-
310-
throw new WaitingAtLobbyRetryError('Microsoft Teams Meeting bot could not enter the meeting...', bodyText ?? '', !userDenied, 2);
309+
310+
// Don't retry lobby errors - if user doesn't admit bot, retrying won't help
311+
throw new WaitingAtLobbyRetryError('Microsoft Teams Meeting bot could not enter the meeting...', bodyText ?? '', false, 0);
311312
}
312313

313314
pushState('joined');
@@ -508,10 +509,8 @@ export class MicrosoftTeamsBot extends MeetBotBase {
508509
});
509510

510511
// Start audio silence detection (runs in parallel with participant detection)
511-
// inactivityLimit is in milliseconds (default 2 minutes = 120000ms)
512-
const inactivityLimitMs = config.inactivityLimit && config.inactivityLimit > 1000
513-
? config.inactivityLimit
514-
: 120000; // Default to 2 minutes
512+
// Convert inactivityLimit from minutes to milliseconds
513+
const inactivityLimitMs = config.inactivityLimit * 60 * 1000;
515514

516515
const monitorAudioSilence = async () => {
517516
try {

src/bots/ZoomBot.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export class ZoomBot extends BotBase {
293293
// Wait in waiting room
294294
try {
295295
const wanderingTime = config.joinWaitTime * 60 * 1000; // Give some time to be let in
296-
296+
297297
let waitTimeout: NodeJS.Timeout;
298298
let waitInterval: NodeJS.Timeout;
299299
const waitAtLobbyPromise = new Promise<boolean>((resolveMe) => {
@@ -355,7 +355,8 @@ export class ZoomBot extends BotBase {
355355

356356
this._logger.error('Cant finish wait at the lobby check', { userDenied, waitingAtLobbySuccess: joined, bodyText });
357357

358-
throw new WaitingAtLobbyRetryError('Zoom bot could not enter the meeting...', bodyText ?? '', !userDenied, 2);
358+
// Don't retry lobby errors - if user doesn't admit bot, retrying won't help
359+
throw new WaitingAtLobbyRetryError('Zoom bot could not enter the meeting...', bodyText ?? '', false, 0);
359360
}
360361

361362
this._logger.info('Bot is entering the meeting after wait room...');

src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ export default {
6060
inactivityLimit: process.env.MEETING_INACTIVITY_MINUTES ? Number(process.env.MEETING_INACTIVITY_MINUTES) : 1,
6161
activateInactivityDetectionAfter: process.env.INACTIVITY_DETECTION_START_DELAY_MINUTES ? Number(process.env.INACTIVITY_DETECTION_START_DELAY_MINUTES) : 1,
6262
serviceKey: process.env.SCREENAPP_BACKEND_SERVICE_API_KEY,
63-
joinWaitTime: 10,
63+
joinWaitTime: process.env.JOIN_WAIT_TIME_MINUTES ? Number(process.env.JOIN_WAIT_TIME_MINUTES) : 10,
64+
// Number of retries for transient errors (not applied to WaitingAtLobbyRetryError)
65+
retryCount: process.env.RETRY_COUNT ? Number(process.env.RETRY_COUNT) : 2,
6466
miscStorageBucket: process.env.GCP_MISC_BUCKET,
6567
miscStorageFolder: process.env.GCP_MISC_BUCKET_FOLDER ? process.env.GCP_MISC_BUCKET_FOLDER : 'meeting-bot',
6668
region: process.env.GCP_DEFAULT_REGION,

0 commit comments

Comments
 (0)