nalgeon / pokitoki

Humble GPT Telegram Bot
MIT License
317 stars 56 forks source link

Requests to openai are blocking #14

Closed HeySlava closed 1 year ago

HeySlava commented 1 year ago

This screenshot requires an explanation: we can see that there is a two-second time difference between my two messages, but I received my response on /help after the response on the "ping" message. Which is strange.

There are cases where it poses a real problem. A few weeks ago, there was an issue with the API where the service returned an error 502.

Failed to answer. Reason: HTTP code 502 from API (<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)

It took a very long time to respond, and I couldn't realize which side the problem is on. I sent the /help command but It didn't work too.

nalgeon commented 1 year ago

The problem is not related to OpenAI requests. By default, the bot processes Telegram updates sequentially, leading to the behavior you've observed.

Fixed in v125 (146c9b9afb2b2be4c91a67c8d8e38035166a5494). Somehow I missed that concurrent updates were disabled.