File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @rocket.chat/ddp-streamer ' : patch
3+ ' @rocket.chat/meteor ' : patch
4+ ---
5+
6+ Fixes an issue that was causing ddp-streamer process to break if the communication with presence service was interrupted for any reason.
Original file line number Diff line number Diff line change @@ -32,3 +32,39 @@ import { startTracing } from '@rocket.chat/tracing';
3232
3333 await api . start ( ) ;
3434} ) ( ) ;
35+
36+ /**
37+ * If some promise is rejected and doesn't have a catch (unhandledRejection) it may cause the process to exit.
38+ *
39+ * Since unhandled rejections are deprecated in NodeJS:
40+ * (node:83382) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections
41+ * that are not handled will terminate the Node.js process with a non-zero exit code.
42+ * we will start respecting this and exit the process to prevent these kind of problems.
43+ */
44+
45+ process . on ( 'unhandledRejection' , ( error ) => {
46+ console . error ( '=== UnHandledPromiseRejection ===' ) ;
47+ console . error ( error ) ;
48+ console . error ( '---------------------------------' ) ;
49+ console . error (
50+ 'Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process' ,
51+ ) ;
52+ console . error ( 'Future node.js versions will automatically exit the process' ) ;
53+ console . error ( '=================================' ) ;
54+
55+ if ( process . env . TEST_MODE || process . env . NODE_ENV === 'development' || process . env . EXIT_UNHANDLEDPROMISEREJECTION ) {
56+ process . exit ( 1 ) ;
57+ }
58+ } ) ;
59+
60+ process . on ( 'uncaughtException' , async ( error ) => {
61+ console . error ( '=== UnCaughtException ===' ) ;
62+ console . error ( error ) ;
63+ console . error ( '-------------------------' ) ;
64+ console . error ( 'Errors like this can cause oplog processing errors.' ) ;
65+ console . error ( '===========================' ) ;
66+
67+ if ( process . env . TEST_MODE || process . env . NODE_ENV === 'development' || process . env . EXIT_UNHANDLEDPROMISEREJECTION ) {
68+ process . exit ( 1 ) ;
69+ }
70+ } ) ;
You can’t perform that action at this time.
0 commit comments