Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise never fulfills #39

Open
zSoulweaver opened this issue Apr 26, 2020 · 4 comments
Open

Promise never fulfills #39

zSoulweaver opened this issue Apr 26, 2020 · 4 comments

Comments

@zSoulweaver
Copy link

Trying to play around with a few things and because of no detailed documentation I'm just going off JSDoc and https://github.com/jellyfin/jellyfin-react-client and have stumbled on an issue.

In the connection file you are calling getApiClient().getPublicSystemInfo(), this returns a promise that won't fulfill if the connection fails.

If the server url is correct and the web api returns the requested data the promise is resolved and fulfilled no problem. Now if the server url is incorrect the console spits out;
Request failed to http://localhost:8097/emby/System/Info/Public TypeError: Failed to fetch Attempting reconnection GET http://localhost:8097/emby/System/Info/Public net::ERR_CONNECTION_REFUSED tryReconnect:
and the promise is indefinitely left in pending.

I've only tested on Windows 10, Node v12 in electron only. I have tried using the library in both my own project and also building the react client to see the issue persist in both.

@heyhippari
Copy link
Contributor

This happens a lot, due to how the Emby devs handled Promises.

The initial cleanup to get this ready for use in jellyfin-web is completed and further cleanup and refactoring should add proper error-handling to this.

@zSoulweaver
Copy link
Author

I'm happy to go through and learn the codebase to try and fix this up, but I've got a question.

I'm assuming it's trying to handle reconnections in the library itself, is this something that the library should handle or should it be up to the user to manage a failed request and do their own reconnection/new request?

@heyhippari
Copy link
Contributor

That should be discussed with the input of @jellyfin/web as a whole, I think.

Right now, we're mostly trying to clean up what's there, to be able to improve it more efficiently. However, it is important to note that once the DB rewrite is done on the server, the basic API will be auto-generated. We'll still have to decide on how to handle the websocket and other things like reconnections, credential management and so on, though.

@zSoulweaver
Copy link
Author

Right, sounds like a bit of effort for something that is probably going to have to be changed anyway. Suppose I'll leave it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants