Comments (10)
Hi @acehko thanks for reporting. What is your expecting behaviour? If you fire a request and your client timeout is too low then you can run into a timeout issue but this does not implicit that the add
won't ping back. In this case you have to increase the $timeout
for you action. This behaviour is normal because we use timeouts to ensure that a service works correctly. You have to remember that we work with a pubsub system (NATS). On the section https://github.com/hemerajs/hemera#handle-timeout-errors I documented this.
from hemera.
@StarpTech My exepected behaviour was at first that it should only call the callback once. I first noticed it in hemera but after a test it seems it is the same with seneca (redis-queue transport). After thinking a bit I think the current behavior is good. It just felt strange when I noticed it.
PS: Is it possible to define a global timeout for all acts?
Edit: I also noticed that the timeout error is not triggering any of the available response events
from hemera.
@acehko I also thinking about the current behaviour and it is possible but we have to implement a add
timeout which has the same value as the requestor timout. The requestor timeout can be transfered over the meta
property but this raise the question is this the correct behaviour even when the request respond correctly? As you said this is the normal behaviour. I think we should't break this and treat it as a problem for the implementer. Increase the timeout if you dont know how long your action can take.
Is it possible to define a global timeout for all acts?
Yes
new Hemera(nats, { timeout: 5000 })
I also noticed that the timeout error is not triggering any of the available response events
Timeouts happens on client side. You get no response back the request will be handled as failed.
from hemera.
@StarpTech I agree that you shouldn't break the current behaviour.
But I think that a TimeoutError
should be treated as a response and should trigger an event.
For example a BusinessError
would trigger the onClientPostRequest
error. The reason is that I use the events to log all requests/responses but with the current behaviour the timeout will not be looged automatically.
from hemera.
That make sense. I will investigate in it.
from hemera.
Thanks. I will close this as the original issue was resolved.
from hemera.
@acehko is implemented see 2b98e05#diff-ee2c2206b5ed08491be6674035f0612a
from hemera.
Hi @acehko I changed the behaviour because NATS has support for this. It is documented here https://hemerajs.github.io/hemera/1_request_reply.html
As of now any request will process exact one response. If you want to get multiple responses you can use the maxMessages$
attribute.
from hemera.
Hi @StarpTech, thank you for the update.
maxMessages$
looks interesting, it could be useful.
But does this mean that the callback will now be called only once?
If the TimeoutError
is generated on the client, I assume the callback will still be called after the service replies
from hemera.
@acehko it means that you can receive only one message but the callback can be called multiple times.
from hemera.
Related Issues (20)
- Logging id HOT 15
- Direct communication ? HOT 3
- stats plugin not returning all actions HOT 7
- Does hemera.close() killall running jobs? HOT 2
- TypeError when defining custom Pino logger HOT 1
- Why https://hemerajs.github.io/hemera/docs/reference.html contains not documentation for add() function. HOT 3
- Adding hemera to Docusaurus users page HOT 3
- Unsubscribe by RegExp HOT 9
- Unable to subscribe to NATS topic when the publisher is not running on Hemera HOT 1
- Client Timeout HOT 3
- hemera-ajv doesnt seem to be working correctly HOT 4
- Hemera-blipp has old hemera version HOT 3
- Have you looked into ts-nats? HOT 3
- How to reply from middleware or extension? HOT 5
- Looking for maintainers and collaborators HOT 5
- NATS disconnection question HOT 1
- Calling reply.send inside async middleware doesn't stop the chain HOT 2
- Typescript support HOT 1
- hemera-zipkin package missing HOT 3
- Any way to unregister an extension? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hemera.