Git Product home page Git Product logo

Comments (10)

StarpTech avatar StarpTech commented on May 23, 2024

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.

acehko avatar acehko commented on May 23, 2024

@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.

StarpTech avatar StarpTech commented on May 23, 2024

@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.

acehko avatar acehko commented on May 23, 2024

@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.

StarpTech avatar StarpTech commented on May 23, 2024

That make sense. I will investigate in it.

from hemera.

acehko avatar acehko commented on May 23, 2024

Thanks. I will close this as the original issue was resolved.

from hemera.

StarpTech avatar StarpTech commented on May 23, 2024

@acehko is implemented see 2b98e05#diff-ee2c2206b5ed08491be6674035f0612a

from hemera.

StarpTech avatar StarpTech commented on May 23, 2024

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.

acehko avatar acehko commented on May 23, 2024

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.

StarpTech avatar StarpTech commented on May 23, 2024

@acehko it means that you can receive only one message but the callback can be called multiple times.

from hemera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.