mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
fix: Improve error handling in GenerationJobManager for allSubscribersLeft handlers
- Enhanced the error handling logic when retrieving content parts for allSubscribersLeft handlers, ensuring that any failures are logged appropriately. - Updated the promise chain to catch errors from getContentParts, improving robustness and clarity in error reporting.
This commit is contained in:
parent
829be5533f
commit
71a1a69568
1 changed files with 17 additions and 9 deletions
|
|
@ -221,16 +221,24 @@ class GenerationJobManagerClass {
|
|||
currentRuntime.syncSent = false;
|
||||
// Call registered handlers (from job.emitter.on('allSubscribersLeft', ...))
|
||||
if (currentRuntime.allSubscribersLeftHandlers) {
|
||||
this.jobStore.getContentParts(streamId).then((content) => {
|
||||
const parts = content ?? [];
|
||||
for (const handler of currentRuntime.allSubscribersLeftHandlers ?? []) {
|
||||
try {
|
||||
handler(parts);
|
||||
} catch (err) {
|
||||
logger.error(`[GenerationJobManager] Error in allSubscribersLeft handler:`, err);
|
||||
this.jobStore
|
||||
.getContentParts(streamId)
|
||||
.then((content) => {
|
||||
const parts = content ?? [];
|
||||
for (const handler of currentRuntime.allSubscribersLeftHandlers ?? []) {
|
||||
try {
|
||||
handler(parts);
|
||||
} catch (err) {
|
||||
logger.error(`[GenerationJobManager] Error in allSubscribersLeft handler:`, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.error(
|
||||
`[GenerationJobManager] Failed to get content parts for allSubscribersLeft handlers:`,
|
||||
err,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue