Is there a way to set a timeout for Ember.RSVP promises or store.findRecord requests?
I know it’s calling $.ajax under the hood, so I could use something like Ember.$.ajaxSetup({ timeout: 5*1000 }) in an initializer, but I was curious if there was a better way.
Ideally I’d like to set timeouts for the RSVP promises of certain routes, but not others, and I’d prefer to fetch the data using ember-data (not a jquery ajax call).
You should avoid coupling promises to timeouts as this can result in unexpected side effects. Isn’t that the whole idea of promises in the first place? Try rethinking the design of your application first.
Also, it’s worth noting that there’s a bunch of conversations on this. Once Ember moves away from using jQuery’s Ajax and (perhaps) uses the new fetch API, this may no longer be an option.