refactor: Improve logging messages for clarity and consistency across services
This commit is contained in:
parent
147d558af5
commit
f3dfb9769f
@ -19,11 +19,11 @@ export const lkWebhookHandler = async (req: Request, res: Response) => {
|
||||
const belongsToOpenViduMeet = await lkWebhookService.webhookEventBelongsToOpenViduMeet(webhookEvent);
|
||||
|
||||
if (!belongsToOpenViduMeet) {
|
||||
logger.verbose(`Skipping webhook, event is not related to OpenVidu Meet: ${eventType}`);
|
||||
logger.verbose(`Webhook skipped: ${eventType}. Not related to OpenVidu Meet.`);
|
||||
return res.status(200).send();
|
||||
}
|
||||
|
||||
logger.verbose(`Received webhook event: ${eventType}`);
|
||||
logger.verbose(`Webhook received: ${eventType}`);
|
||||
|
||||
switch (eventType) {
|
||||
case 'egress_started':
|
||||
|
||||
@ -8,7 +8,7 @@ export const startRecording = async (req: Request, res: Response) => {
|
||||
const logger = container.get(LoggerService);
|
||||
const recordingService = container.get(RecordingService);
|
||||
const { roomId } = req.body;
|
||||
logger.info(`Starting recording in ${roomId}`);
|
||||
logger.info(`Initiating recording for room ${roomId}`);
|
||||
|
||||
try {
|
||||
const recordingInfo = await recordingService.startRecording(roomId);
|
||||
@ -90,7 +90,7 @@ export const stopRecording = async (req: Request, res: Response) => {
|
||||
const recordingId = req.params.recordingId;
|
||||
|
||||
try {
|
||||
logger.info(`Stopping recording ${recordingId}`);
|
||||
logger.info(`Initiating stop for recording ${recordingId}`);
|
||||
const recordingService = container.get(RecordingService);
|
||||
|
||||
const recordingInfo = await recordingService.stopRecording(recordingId);
|
||||
|
||||
@ -212,11 +212,7 @@ export class RoomService {
|
||||
* @returns A promise that resolves when the signal has been sent.
|
||||
*/
|
||||
async sendSignal(roomName: string, rawData: any, options: SendDataOptions): Promise<void> {
|
||||
this.logger.verbose(
|
||||
`Sending signal "${options.topic}" to ${
|
||||
options.destinationIdentities ? `participant(s) ${options.destinationIdentities}` : 'all participants'
|
||||
} in room "${roomName}".`
|
||||
);
|
||||
this.logger.verbose(`Notifying participants in room ${roomName}: "${options.topic}".`);
|
||||
this.livekitService.sendData(roomName, rawData, options);
|
||||
}
|
||||
|
||||
|
||||
@ -95,10 +95,10 @@ export class S3Service {
|
||||
Body: JSON.stringify(body)
|
||||
});
|
||||
const result = await this.retryOperation<PutObjectCommandOutput>(() => this.run(command));
|
||||
this.logger.info(`S3 saveObject: successfully saved object ${fullKey} in bucket ${bucket}`);
|
||||
this.logger.info(`S3: successfully saved object '${fullKey}' in bucket '${bucket}'`);
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
this.logger.error(`S3 saveObject: error putting object ${fullKey} in bucket ${bucket}: ${error}`);
|
||||
this.logger.error(`S3: error saving object '${fullKey}' in bucket '${bucket}': ${error}`);
|
||||
|
||||
if (error.code === 'ECONNREFUSED') {
|
||||
throw errorS3NotAvailable(error);
|
||||
@ -404,7 +404,7 @@ export class S3Service {
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
this.logger.verbose(`S3 retryOperation: attempt ${attempt + 1}`);
|
||||
this.logger.verbose(`S3 operation: attempt ${attempt + 1}`);
|
||||
return await operation();
|
||||
} catch (error) {
|
||||
attempt++;
|
||||
|
||||
@ -27,8 +27,7 @@ export class TaskSchedulerService {
|
||||
* @returns A promise that resolves when the garbage collector has been successfully started.
|
||||
*/
|
||||
async startRoomGarbageCollector(callbackFn: () => Promise<void>): Promise<void> {
|
||||
const lockTtl = 59 * 60 * 1000; // TTL of 59 minutes
|
||||
|
||||
// Stop the existing job if it exists
|
||||
if (this.roomGarbageCollectorJob) {
|
||||
this.roomGarbageCollectorJob.stop();
|
||||
this.roomGarbageCollectorJob = null;
|
||||
@ -37,7 +36,7 @@ export class TaskSchedulerService {
|
||||
// Create a cron job to run every hour
|
||||
this.roomGarbageCollectorJob = new CronJob('0 * * * *', async () => {
|
||||
try {
|
||||
const lock = await this.mutexService.acquire(RedisLockName.GARBAGE_COLLECTOR, lockTtl);
|
||||
const lock = await this.mutexService.acquire(MeetLock.getRoomGarbageCollectorLock(), ms('59m'));
|
||||
|
||||
if (!lock) {
|
||||
this.logger.debug('Failed to acquire lock for room garbage collection. Skipping.');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user