Merge pull request #799 from shocknet/fix-subp-err

fix send error
This commit is contained in:
Justin (shocknet) 2025-05-07 12:25:57 -04:00 committed by GitHub
commit 8094abf879
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View file

@ -494,9 +494,13 @@ class StorageProcessor {
private sendResponse(response: OperationResponse<any>) { private sendResponse(response: OperationResponse<any>) {
try { try {
if (process.send) { if (process.send) {
process.send(response); process.send(response, undefined, undefined, err => {
if (err) {
console.error("failed to send response to main process from storage processor, killing sub process")
process.exit(1)
}
});
} }
} catch (error) { } catch (error) {
console.error("failed to send response to main process from storage processor, killing sub process") console.error("failed to send response to main process from storage processor, killing sub process")

View file

@ -106,7 +106,7 @@ class TlvFilesStorageProcessor {
}); });
process.on('error', (error: Error) => { process.on('error', (error: Error) => {
console.error('Error in storage processor:', error); console.error('Error in tlv files storage processor:', error);
}); });
this.wrtc = new webRTC(t => { this.wrtc = new webRTC(t => {
@ -358,7 +358,12 @@ class TlvFilesStorageProcessor {
private sendResponse<T>(response: TlvOperationResponse<T>) { private sendResponse<T>(response: TlvOperationResponse<T>) {
try { try {
if (process.send) { if (process.send) {
process.send(response); process.send(response, undefined, undefined, err => {
if (err) {
console.error("failed to send response to main process from tlv files storage processor, killing sub process")
process.exit(1)
}
});
} }
} catch (error) { } catch (error) {
console.error("failed to send response to main process from tlv files storage processor, killing sub process") console.error("failed to send response to main process from tlv files storage processor, killing sub process")