I
I
Ignatiy22021-05-10 16:00:10
C++ / C#
Ignatiy2, 2021-05-10 16:00:10

Why can there be delays in the telegram bot?

The bot is written in asp.net core (with webhooks). The problem is that if no one uses the bot for a long time, it starts responding to the first request after this long time with a delay. In this case, the delay seems to be proportional to this time. For example, if you do not send requests to the bot for 3 hours, a delay is created for the first request of about 2-3 seconds, after which everything falls into place. Has anyone encountered such a problem? The structure of my project is something like this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2021-05-14
@Wyrd

I would venture to suggest that you run your bot on IIS, if so, then the problem is most likely in the IIS App Pool Recycling settings - by default, IIS restarts the application once a day + (when) stops it if no request has been processed within 20 minutes. Starting after that just takes a few seconds.
Here is a picture of how to disable it, there are nuances, so it's better to read the comments - https://stackoverflow.com/questions/51348433/iis-1...
You also write that the startup time depends on the idle time .. I hope it seemed to you, because it’s hard to imagine how this is possible find the data in the cache, and the larger the volume must be read from the disk at startup).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question