question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation about handling timeout in microservices

See original GitHub issue

I’m submitting a…


[ ] Regression 
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request (new chapter/page)
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Expected behavior

Ref https://github.com/nestjs/nest/issues/1414#issuecomment-451449323

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitryblackwellcommented, May 24, 2020

Thanks to this comment I found a solution. So I leave it here, in case, someone will face same problem.

What you have to do is install rxjs package:

yarn add rxjs

Then just add call of timeout method to the pipe:

import { timeout } from 'rxjs/operators';
// ...
this.client
      .send<Device[], any>(Message.GET_DEVICES, {})
      .pipe(timeout(5000))
      .toPromise();

After 5 seconds, if microservice isn’t responding, it will throw an error:

[Nest] 17544   - 05/24/2020, 8:08:27 AM   [ExceptionsHandler] Timeout has occurred +5009ms
0reactions
kamilmysliwieccommented, Feb 22, 2021

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timeout Pattern - Microservice Design Patterns - Vinsguru
This tutorial explains Timeout Pattern which is one of the Microservice Design Patterns for designing highly resilient Microservices.
Read more >
Handling timeouts in a microservice architecture - YouTube
Cohort-based Course on System Design: https://arpitbhayani.me/masterclassHandling timeout well is extremely critical as it makes your ...
Read more >
Microservices Aren't Magic: Handling Timeouts | 8th Light
Timeouts (or worse, infinitely long waiting) are a fundamental fact of life with distributed systems, and we need to know how to handle...
Read more >
Setting a Request Timeout for a Spring REST API - Baeldung
Then we'll discuss the benefits and drawbacks of each. Request timeouts are useful for preventing a poor user experience, especially if there's ...
Read more >
Setting a timeout in distributed services is a good practice to ...
Tagged with microservices, polly, csharp, timeout. ... But this week the client reported a problem to view documents, it was very slow.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found