aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-06 11:59:27 +0200
committerChocobozzz <me@florianbigard.com>2023-06-06 11:59:27 +0200
commit07880c3642ca9fd9363850cf1a8e3cd2c6d9cd59 (patch)
tree6963c6af68f54e894b8396539a0819209ca3385e /server
parent25d7cc3cb675de36fe67402e307e1ba02f3316bc (diff)
downloadPeerTube-07880c3642ca9fd9363850cf1a8e3cd2c6d9cd59.tar.gz
PeerTube-07880c3642ca9fd9363850cf1a8e3cd2c6d9cd59.tar.zst
PeerTube-07880c3642ca9fd9363850cf1a8e3cd2c6d9cd59.zip
Correctly unload plugin paths
Diffstat (limited to 'server')
-rw-r--r--server/helpers/decache.ts10
-rw-r--r--server/lib/plugins/plugin-manager.ts2
2 files changed, 6 insertions, 6 deletions
diff --git a/server/helpers/decache.ts b/server/helpers/decache.ts
index 08ab545e4..6be446ff6 100644
--- a/server/helpers/decache.ts
+++ b/server/helpers/decache.ts
@@ -3,16 +3,16 @@
3 3
4import { extname } from 'path' 4import { extname } from 'path'
5 5
6function decachePlugin (pluginPath: string, libraryPath: string) { 6function decachePlugin (libraryPath: string) {
7 const moduleName = find(libraryPath) 7 const moduleName = find(libraryPath)
8 8
9 if (!moduleName) return 9 if (!moduleName) return
10 10
11 searchCache(moduleName, function (mod) { 11 searchCache(moduleName, function (mod) {
12 delete require.cache[mod.id] 12 delete require.cache[mod.id]
13 })
14 13
15 removeCachedPath(pluginPath) 14 removeCachedPath(mod.path)
15 })
16} 16}
17 17
18function decacheModule (name: string) { 18function decacheModule (name: string) {
@@ -22,9 +22,9 @@ function decacheModule (name: string) {
22 22
23 searchCache(moduleName, function (mod) { 23 searchCache(moduleName, function (mod) {
24 delete require.cache[mod.id] 24 delete require.cache[mod.id]
25 })
26 25
27 removeCachedPath(moduleName) 26 removeCachedPath(mod.path)
27 })
28} 28}
29 29
30// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index 9086a4c8e..88c5b60d7 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -496,7 +496,7 @@ export class PluginManager implements ServerHook {
496 496
497 // Delete cache if needed 497 // Delete cache if needed
498 const modulePath = join(pluginPath, packageJSON.library) 498 const modulePath = join(pluginPath, packageJSON.library)
499 decachePlugin(pluginPath, modulePath) 499 decachePlugin(modulePath)
500 const library: PluginLibrary = require(modulePath) 500 const library: PluginLibrary = require(modulePath)
501 501
502 if (!isLibraryCodeValid(library)) { 502 if (!isLibraryCodeValid(library)) {