diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-17 09:40:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-17 09:47:41 +0200 |
commit | 609a444202b4cf97f962ed596aac4d0d7b7f63fe (patch) | |
tree | 7c4c20a24f3172d965aa9a2e102b1aac5491b39c /server/lib/live/shared/muxing-session.ts | |
parent | c6406f47500114ef4f215ecf4c641b4f1cc2fb76 (diff) | |
download | PeerTube-609a444202b4cf97f962ed596aac4d0d7b7f63fe.tar.gz PeerTube-609a444202b4cf97f962ed596aac4d0d7b7f63fe.tar.zst PeerTube-609a444202b4cf97f962ed596aac4d0d7b7f63fe.zip |
Fix memory leak
Diffstat (limited to 'server/lib/live/shared/muxing-session.ts')
-rw-r--r-- | server/lib/live/shared/muxing-session.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 96f6c2c89..7788eea2d 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts | |||
@@ -60,6 +60,8 @@ class MuxingSession extends EventEmitter { | |||
60 | private readonly videoUUID: string | 60 | private readonly videoUUID: string |
61 | private readonly saveReplay: boolean | 61 | private readonly saveReplay: boolean |
62 | 62 | ||
63 | private toto: Buffer | ||
64 | |||
63 | private readonly lTags: LoggerTagsFn | 65 | private readonly lTags: LoggerTagsFn |
64 | 66 | ||
65 | private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {} | 67 | private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {} |
@@ -102,6 +104,8 @@ class MuxingSession extends EventEmitter { | |||
102 | this.saveReplay = this.videoLive.saveReplay | 104 | this.saveReplay = this.videoLive.saveReplay |
103 | 105 | ||
104 | this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID) | 106 | this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID) |
107 | |||
108 | this.toto = Buffer.alloc(1_000_000_000) | ||
105 | } | 109 | } |
106 | 110 | ||
107 | async runMuxing () { | 111 | async runMuxing () { |
@@ -135,10 +139,15 @@ class MuxingSession extends EventEmitter { | |||
135 | } | 139 | } |
136 | 140 | ||
137 | abort () { | 141 | abort () { |
138 | if (!this.ffmpegCommand) return false | 142 | if (!this.ffmpegCommand) return |
139 | 143 | ||
140 | this.ffmpegCommand.kill('SIGINT') | 144 | this.ffmpegCommand.kill('SIGINT') |
141 | return true | 145 | } |
146 | |||
147 | destroy () { | ||
148 | this.removeAllListeners() | ||
149 | this.isAbleToUploadVideoWithCache.clear() | ||
150 | this.hasClientSocketInBadHealthWithCache.clear() | ||
142 | } | 151 | } |
143 | 152 | ||
144 | private onFFmpegError (err: any, stdout: string, stderr: string, outPath: string) { | 153 | private onFFmpegError (err: any, stdout: string, stderr: string, outPath: string) { |