Skip to content

Commit d8e72e9

Browse files
committed
remove process.exit() if sse fails
1 parent 9fdc7d8 commit d8e72e9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/lib/utils.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ export function createBasicAuthToken(username: string, accessKey: string): strin
750750
export async function listenToSmartUISSE(
751751
baseURL: string,
752752
accessToken: string,
753+
ctx: Context,
753754
onEvent?: (eventType: string, data: any) => void
754755
): Promise<{ abort: () => void }> {
755756
const url = `${baseURL}/api/v1/sse/smartui`;
@@ -820,14 +821,14 @@ export async function listenToSmartUISSE(
820821
}
821822
}
822823
} catch (streamError: any) {
823-
console.error('SSE Streaming error:', streamError);
824+
ctx.log.debug('SSE Streaming error:', streamError);
824825
onEvent?.('error', streamError);
825826
} finally {
826827
reader.releaseLock();
827828
}
828829

829830
} catch (error) {
830-
console.error('SSE Connection error:', error);
831+
ctx.log.debug('SSE Connection error:', error);
831832
onEvent?.('error', error);
832833
}
833834

@@ -850,6 +851,7 @@ export async function startSSEListener(ctx: Context) {
850851
currentConnection = await listenToSmartUISSE(
851852
ctx.env.SMARTUI_SSE_URL,
852853
basicAuthToken,
854+
ctx,
853855
(eventType, data) => {
854856
switch (eventType) {
855857
case 'open':
@@ -864,11 +866,7 @@ export async function startSSEListener(ctx: Context) {
864866
ctx.log.debug('Build completed');
865867
console.log('Build completed');
866868
currentConnection?.abort();
867-
if(errorCount > 0) {
868-
process.exit(1);
869-
}
870-
process.exit(0);
871-
869+
break;
872870
case 'DOTUIError':
873871
if (data.buildId== ctx.build.id) {
874872
errorCount++;
@@ -879,7 +877,7 @@ export async function startSSEListener(ctx: Context) {
879877
case 'error':
880878
ctx.log.debug('SSE Error occurred:', data);
881879
currentConnection?.abort();
882-
process.exit(0);
880+
break;
883881

884882
}
885883
}

0 commit comments

Comments
 (0)