Terbau / fortnitepy

Async python library for interacting with Fortnite's API and XMPP services.
MIT License
148 stars 50 forks source link

added timeout in accept_friend #154

Open gfdb opened 3 years ago

gfdb commented 3 years ago

The Client.accept_friend method calls the Client.wait_for method without any timeout parameter. As a result, when asyncio.wait_for is called in Client.wait_for, timeout = None is passed which causes a block until the future check=lambda f: f.id == user_id completes. This pull request just adds a 60 second timeout so that, in the event that the future never completes, accept_friend does not block.

gfdb commented 3 years ago

Changed timeout default from 60 seconds to None to be backwards compatible with existing implementations of the method. Also, made timeout a parameter of Client.accept_friend. It is a parameter of Client.wait_for and asyncio.wait_for so it is a parameter that you should be able to set when calling Client.accept_friend.