mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Fix socket.io websocket connection
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
import * as child from 'child_process'
|
||||
import { fork, ChildProcess } from 'child_process'
|
||||
|
||||
class MockSmtpServer {
|
||||
|
||||
private static instance: MockSmtpServer
|
||||
private started = false
|
||||
private emailChildProcess: child.ChildProcess
|
||||
private emailChildProcess: ChildProcess
|
||||
private emails: object[]
|
||||
|
||||
private constructor () {
|
||||
this.emailChildProcess = child.fork(`${__dirname}/email-child-process`, [], { silent: true })
|
||||
this.emailChildProcess = fork(`${__dirname}/email-child-process`, [])
|
||||
|
||||
this.emailChildProcess.on('message', (msg) => {
|
||||
if (msg.email) {
|
||||
return this.emails.push(msg.email)
|
||||
}
|
||||
})
|
||||
process.on('exit', () => {
|
||||
this.emailChildProcess.kill()
|
||||
})
|
||||
}
|
||||
|
||||
collectEmails (emailsCollection: object[]) {
|
||||
@@ -43,6 +41,13 @@ class MockSmtpServer {
|
||||
})
|
||||
}
|
||||
|
||||
kill () {
|
||||
process.kill(this.emailChildProcess.pid)
|
||||
|
||||
this.emailChildProcess = null
|
||||
MockSmtpServer.instance = null
|
||||
}
|
||||
|
||||
static get Instance () {
|
||||
return this.instance || (this.instance = new this())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user