Update comments.

This commit is contained in:
John Livingston 2021-06-02 12:48:24 +02:00
parent af20f3918f
commit d2df17c7b9

View File

@ -3,8 +3,8 @@ import { initRouters } from './lib/routers/index'
import { ensureProsodyRunning, ensureProsodyNotRunning } from './lib/prosody/ctl' import { ensureProsodyRunning, ensureProsodyNotRunning } from './lib/prosody/ctl'
import decache from 'decache' import decache from 'decache'
// FIXME: in Peertube <= 3.1.0, unregister don't have any parameter. // FIXME: Peertube unregister don't have any parameter.
// Using this global variable to fix this. // Using this global variable to fix this, so we can use helpers to unregister.
let OPTIONS: RegisterServerOptions | undefined let OPTIONS: RegisterServerOptions | undefined
async function register (options: RegisterServerOptions): Promise<any> { async function register (options: RegisterServerOptions): Promise<any> {
@ -27,7 +27,8 @@ async function unregister (): Promise<any> {
const module = __filename const module = __filename
OPTIONS?.peertubeHelpers.logger.info(`Unloading module ${module}...`) OPTIONS?.peertubeHelpers.logger.info(`Unloading module ${module}...`)
// In peertube <= 3.1.0 sub modules are not removed from require.cache // Peertube calls decache(plugin) on register, not unregister.
// Will do here, to release memory.
decache(module) decache(module)
OPTIONS?.peertubeHelpers.logger.info(`Successfully unloaded the module ${module}`) OPTIONS?.peertubeHelpers.logger.info(`Successfully unloaded the module ${module}`)
OPTIONS = undefined OPTIONS = undefined