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