Open mrabedini opened 7 years ago
with some logging, I've found that in some requests that there is no response of the bot, the cls.bot_tokens is empty.
I found the problem. In gunicorn the number of workers were set to 3. Just one of them could have bot_tokens and two of them didn't have the tokens. When I set the number of workers to 1, everything is ok. Now the question is what should I do to get it to work with number of workers 3 in gunicorn.
Can you try to comment this line https://github.com/JungDev/django-telegrambot/blob/master/django_telegrambot/apps.py#L126 , please?
Yes, it solved the problem. What the line is for?!
It's a flag to prevent re-running code which should be executed exactly one time.
I have the same problem. The settings is:
DJANGO_TELEGRAMBOT = {
'MODE' : 'WEBHOOK',
'WEBHOOK_SITE' : 'https://example.com/',
'BOTS' : [
{
'TOKEN': 'botToken',
},
],
}
I commented the apps.py 126th line and restarted server. But problem still exist. Logging says that 'Not Found: /botToken/'. How can I solve the issue?
@JungDev @mrabedini Ok, that's what i found
This error is mainly caused by TelegramError (Flood control), which is caused by rapid setWebhook queries.
Perhaps, if bot.getWebhookInfo().url != hookurl: <set webhook>
check will help.
It seems that the problem still remains. When I use gunicorn with supervisor, I have the same issue. I tried to regenerate the issue with docker. Using gunicorn with --bind option and nginx serving the requests didn't have any problem. My next try would be to add supervisor to the simulation. However, as I mentioned earlier in the current comment, on the server I still have the problem.
This error raise with uWSGI too.
Looks like MR #10 fix this problem.
Agree with @aliaksandrmelnik, most commonly encountered issue is telegram.error.RetryAfter: Flood control exceeded. Retry in 1 seconds
.
@mrabedini Had the same problem with gunicorn. Setting --workers=1
helped.
@JungDev Is PR #8 going to be the only solution?
First, I should thank you for your great app. In polling mode on my local machine the module works like charm. However when I use the web hook mode, sometimes I get the
error and no response is given by the bot. I didn't setup the cert file in my settings.py . I am using nginx with combination of gunicorn to serve my web app. The server os is ubuntu 16.04. Below is the settings I've used:
The thing that intrigues is the point that sometimes my bot works. Any advice to solve the issue is appreciated.