OctoPrint-Telegram icon indicating copy to clipboard operation
OctoPrint-Telegram copied to clipboard

Many request to api.telegram.org

Open slipx06 opened this issue 5 years ago • 6 comments

This plugin makes multiple requests to api.telegram.org. Seems to be every 30 seconds. I'm not sure if this is "normal" behavior. As a work around I created a manual entry in the /etc/hosts file to stop the constant lookups hammering my DNS server

image

image

image

slipx06 avatar Oct 06 '19 20:10 slipx06

I’m not sure I understand where the bug is. Yes, it is normal for a telegram bot to poll for new messages, once every 30 seconds seems pretty fair compromise between responsiveness and load. If a DNS can’t handle a simple cacheable request every 30 seconds I would be concerned by the DNS server capabilities rather than by the rightfulness of the requests.... Your DNS should receive the request and just reply with the same value you entered in the /et/hosts for around 24 hours, then it should check again if the value it’s still correct... you should have absolutely no need for hard coding it in your hosts file

rlogiacco avatar Oct 06 '19 23:10 rlogiacco

Can we not optimise this i.e. don't poll if OctoPrint is offline?

slipx06 avatar Oct 07 '19 09:10 slipx06

If by offline you mean power down than no request is issued by a device that is powered off, if you mean disconnected from the internet then the only way to know that is by submitting a request...

If you mean reduce the poll frequency when multiple "unavailable host" responses are returned, feel free to submit a pull request implementing such a feature: the plugin author is generally welcoming any improvement.

Personally I don't feel the need for that: I'm generally connected to the internet and my 20€ home router happily complies with the current poll frequency.

rlogiacco avatar Oct 07 '19 09:10 rlogiacco

When I say offline, I am referring to the printer being offline or disconnected. As I understand this plugin is only used when the printer is online.

slipx06 avatar Oct 07 '19 09:10 slipx06

No, the plugin works fine when the printer is not connected. That's what the /con command is for.

MarcusWolschon avatar Feb 21 '20 10:02 MarcusWolschon

In my opinion the problem is that the TTL of api.telegram.org DNS entry is 300 seconds, that provokes the frequent DNS queries to refresh the value every 5 minutes. I don't understand why they use such a low value, I don't think the IP changes that often to justify that.

crunis avatar Oct 13 '21 12:10 crunis