Skip to content

Commit 1ab9513

Browse files
Merge pull request nestjs#2319 from micalevisk/patch-1
docs(microservices): drop deprecated `toPromise` from snippets
2 parents 4dcad2a + 92e6f4a commit 1ab9513

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

content/microservices/basics.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -355,21 +355,19 @@ The `data` property is the message payload sent by the message producer. The `pa
355355

356356
#### Handling timeouts
357357

358-
In distributed systems, sometimes microservices might be down or not available. To avoid infinitely long waiting, you can use Timeouts. A timeout is an incredibly useful pattern when communicating with other services. To apply timeouts to your microservice calls, you can use the `RxJS` timeout operator. If the microservice does not respond to the request within a certain time, an exception is thrown, which can be caught and handled appropriately.
358+
In distributed systems, sometimes microservices might be down or not available. To avoid infinitely long waiting, you can use Timeouts. A timeout is an incredibly useful pattern when communicating with other services. To apply timeouts to your microservice calls, you can use the [RxJS](https://rxjs.dev) `timeout` operator. If the microservice does not respond to the request within a certain time, an exception is thrown, which can be caught and handled appropriately.
359359

360-
To solve this problem you have to use [rxjs](https://github.com/ReactiveX/rxjs) package. Just use the `timeout` operator in the pipe:
360+
To solve this problem you have to use [`rxjs`](https://github.com/ReactiveX/rxjs) package. Just use the `timeout` operator in the pipe:
361361

362362
```typescript
363363
@@filename()
364364
this.client
365365
.send<TResult, TInput>(pattern, data)
366-
.pipe(timeout(5000))
367-
.toPromise();
366+
.pipe(timeout(5000));
368367
@@switch
369368
this.client
370369
.send(pattern, data)
371-
.pipe(timeout(5000))
372-
.toPromise();
370+
.pipe(timeout(5000));
373371
```
374372

375373
> info **Hint** The `timeout` operator is imported from the `rxjs/operators` package.

0 commit comments

Comments
 (0)