dylanshine / openai-kit

A community Swift package used to interact with the OpenAI API
https://platform.openai.com/docs/api-reference
MIT License
692 stars 107 forks source link

WARNING: Hang Risk on setting up HTTP client #44

Closed bluepixeltech closed 1 year ago

bluepixeltech commented 1 year ago

Hi, thanks for the good work on the library!

When I setup the http client as mentioned in your docs, i.e.:

let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) let httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))

I receive the following warning:

Hang Risk Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions

Any help on how to fix this would be appreciated!

bluepixeltech commented 1 year ago
Screenshot 2023-05-02 at 12 58 00
Madongming commented 1 year ago

Same as my problem, waiting fixed.

ftp27 commented 1 year ago

It won't be fixed. https://github.com/apple/swift-nio/issues/2223 You can try to init eventLoopGroup in another thread as mentioned in the issue above.