moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
291 stars 118 forks source link

`callOptions.timeout` takes precedence over `action.timeout` #231

Closed SupremeTechnopriest closed 3 years ago

SupremeTechnopriest commented 3 years ago

If you set callOptions.timeout on the routes:

callOptions: {
  timeout: 10000
}

and try to override it for a specific action:

action: {
  timeout: 30000,
  params: { ... },
  async handler (ctx) { ... }
}

The callOptions value takes precedence. I would expect to be able to override this behavior per route.

icebob commented 3 years ago

The callOptions timeout has always precedence.

  1. timeout in ctx calling options (the `callOptions.timeout set it)
  2. timeout in action definition
  3. requestTimeout in broker options.
SupremeTechnopriest commented 3 years ago

Ah makes sense. Its because callOptions are passed directly to the call function. I have a bunch of different route groups in my project. About 6 different sets of routes. What I would like to be able to do is set a default timeout for the group of routes and be able to override that per action. Maybe callOptions is not the place to do that. Is there a requestTimeout option directly on the routes that we can set so that action values can override them?

icebob commented 3 years ago

I think, you can't do that. Only callOptions is configurable in the routes.

SupremeTechnopriest commented 3 years ago

Okay no problem. I got my backend to stop timing out by upping the callOptions timeout so Im good to go. This would just be a nice to have I think. You can feel free to close this.