Skip to content

Commit

Permalink
fix: check-types variables never used into test e2e and rooms.service
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmatau79 committed Dec 12, 2024
1 parent c8e9227 commit e75ad74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
19 changes: 16 additions & 3 deletions src/rooms/rooms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import {
CreateBroadcasterProducerDto,
CreateBroadcasterTransportDto,
} from './dto/rooms.dto'

import * as protoo from 'protoo-server'
import * as url from 'url'
import { Server } from 'https'
import { NotificationService } from '../lib/notification.service'
import { LogLevel } from '@nestjs/common'

@Injectable()
export class RoomsService implements OnModuleInit, OnModuleDestroy {
Expand Down Expand Up @@ -186,8 +184,15 @@ export class RoomsService implements OnModuleInit, OnModuleDestroy {
}
}

/**
* Closes all active Mediasoup workers.
*
* This method iterates over the list of Mediasoup workers, logs the closure process for each worker,
* and invokes the `close` method to terminate them. After closing, the workers list is cleared.
*
* @returns {Promise<void>} Resolves when all workers are closed and the list is cleared.
*/
private async closeMediasoupWorkers(): Promise<void> {
const numWorkers = config.mediasoup.numWorkers
this.logger.log(`Close ${this.mediasoupWorkers.length} Mediasoup Workers`)
this.mediasoupWorkers.forEach((worker) => {
this.logger.debug(`Closing Mediasoup Worker [pid:${worker.pid}]`)
Expand All @@ -196,6 +201,14 @@ export class RoomsService implements OnModuleInit, OnModuleDestroy {
this.mediasoupWorkers.length = 0
}

/**
* Closes all active rooms.
*
* This method iterates through all active rooms, logs the closure process for each room,
* invokes the `close` method on each room to terminate it, and then clears the rooms map.
*
* @returns {Promise<void>} Resolves when all rooms are closed and the map is cleared.
*/
private async closeRooms(): Promise<void> {
// Close all active rooms
for (const [roomId, room] of this.rooms.entries()) {
Expand Down
5 changes: 1 addition & 4 deletions test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import * as fs from 'fs'
import { createServer, Server } from 'https'
import * as protooClient from 'protoo-client'
import { ConsoleLogger, INestApplication, ValidationPipe } from '@nestjs/common'
import { Test } from '@nestjs/testing'
import * as express from 'express'
import { ExpressAdapter } from '@nestjs/platform-express'
import { AppModule } from '../src/app.module'
import * as request from 'supertest'
import * as selfsigned from 'selfsigned'
import { RoomsService } from '../src/rooms/rooms.service'
import { RoomsModule } from '../src/rooms/rooms.module'

jest.setTimeout(20000)

describe('Protoo WebSocket E2E Test', () => {
Expand Down

0 comments on commit e75ad74

Please sign in to comment.