Merge pull request #836 from shocknet/relay-reconnect
Relay reconnect + throw sub p errs
This commit is contained in:
commit
c31360b0cd
4 changed files with 10 additions and 3 deletions
|
|
@ -184,9 +184,11 @@ export default class Handler {
|
||||||
|
|
||||||
log("connected, subbing...")
|
log("connected, subbing...")
|
||||||
relay.onclose = (() => {
|
relay.onclose = (() => {
|
||||||
log("relay disconnected, will try to reconnect")
|
log("relay disconnected, will try to reconnect in 2 seconds")
|
||||||
relay.close()
|
relay.close()
|
||||||
|
setTimeout(() => {
|
||||||
this.Connect()
|
this.Connect()
|
||||||
|
}, 2000)
|
||||||
})
|
})
|
||||||
|
|
||||||
const appIds = Object.keys(this.apps)
|
const appIds = Object.keys(this.apps)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ export default class NostrSubprocess {
|
||||||
constructor(settings: NostrSettings, utils: Utils, eventCallback: EventCallback) {
|
constructor(settings: NostrSettings, utils: Utils, eventCallback: EventCallback) {
|
||||||
this.utils = utils
|
this.utils = utils
|
||||||
this.childProcess = fork("./build/src/services/nostr/handler")
|
this.childProcess = fork("./build/src/services/nostr/handler")
|
||||||
this.childProcess.on("error", console.error)
|
this.childProcess.on("error", (error) => {
|
||||||
|
console.error("nostr subprocess error")
|
||||||
|
throw error
|
||||||
|
})
|
||||||
this.childProcess.on("message", (message: ChildProcessResponse) => {
|
this.childProcess.on("message", (message: ChildProcessResponse) => {
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case 'ready':
|
case 'ready':
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ export class StorageInterface extends EventEmitter {
|
||||||
this.process.on('error', (error: Error) => {
|
this.process.on('error', (error: Error) => {
|
||||||
console.error('Storage processor error:', error);
|
console.error('Storage processor error:', error);
|
||||||
this.isConnected = false;
|
this.isConnected = false;
|
||||||
|
throw error
|
||||||
});
|
});
|
||||||
|
|
||||||
this.process.on('exit', (code: number) => {
|
this.process.on('exit', (code: number) => {
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ class TlvFilesStorageProcessor {
|
||||||
|
|
||||||
process.on('error', (error: Error) => {
|
process.on('error', (error: Error) => {
|
||||||
console.error('Error in tlv files storage processor:', error);
|
console.error('Error in tlv files storage processor:', error);
|
||||||
|
throw error
|
||||||
});
|
});
|
||||||
|
|
||||||
this.wrtc = new webRTC(t => {
|
this.wrtc = new webRTC(t => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue