Skip to content

Commit

Permalink
fix(microservices): fix handling of errors when using observables
Browse files Browse the repository at this point in the history
  • Loading branch information
davidschuette committed May 1, 2022
1 parent 75eb3f0 commit a09572e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/microservices/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
EMPTY,
from as fromPromise,
isObservable,
lastValueFrom,
Observable,
ObservedValueOf,
of,
Expand Down Expand Up @@ -117,11 +118,7 @@ export abstract class Server {
}
const resultOrStream = await handler(packet.data, context);
if (isObservable(resultOrStream)) {
const connectableSource = connectable(resultOrStream, {
connector: () => new Subject(),
resetOnDisconnect: false,
});
connectableSource.connect();
await lastValueFrom(resultOrStream);
}
}

Expand Down

0 comments on commit a09572e

Please sign in to comment.