Moya: Eidolon goes into deadlock when requesting from network whilst offline?
I noticed an interesting bug with my networking code. All of my requests go through this observable, that I think pulled code 1:1 from https://github.com/artsy/eidolon:
return online
.ignore(false) // Wait until we're online
.take(1) // Take 1 to make sure we only invoke the API once.
.flatMap { _ in // Turn the online state into a network request
return actualRequest
}
The issue I’m running in to is when the app is completely offline, my request never returns. i.e. I request logIn
, and my UI is blocked for eternity, or until I relaunch the app. Should I be running my requests with a timeout to prevent this sort of deadlock?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (15 by maintainers)
@ashfurrow yup, that sounds like the way it should be done.
I’ve been thinking: it would be really useful to extract Eidolen’s networking stack into a sub-repo. Two reasons:
I’m free today, I could create the repo (not sure if it makes sense to have it under artsy or Moya), and then also create a PR to eidolon that removes the code from
App/Networking/
and includes it through the new repoCheers