logram icon indicating copy to clipboard operation
logram copied to clipboard

Crashes when it cannot send a message

Open hugoh opened this issue 3 years ago • 1 comments

I had logram try to send a message while my Internet was down:

Jan 25 03:06:37 logram[44771]: Error: A network error: error sending request for url (https://api.telegram.org/botXXXX/sendMessage): connection error: Connection reset by peer (os error 104)
Jan 25 03:06:37 logram[44771]: Caused by:
Jan 25 03:06:37 logram[44771]:     0: error sending request for url (https://api.telegram.org/botXXXX/sendMessage): connection error: Connection reset by peer (os error 104)
Jan 25 03:06:37 logram[44771]:     1: connection error: Connection reset by peer (os error 104)
Jan 25 03:06:37 logram[44771]:     2: Connection reset by peer (os error 104)
Jan 25 03:06:37 systemd[1]: logram.service: Main process exited, code=exited, status=1/FAILURE
Jan 25 03:06:37 systemd[1]: logram.service: Failed with result 'exit-code'.

I would love for an option for logram to keep trying to send the message for N amount of time. In my case, the process crashed, and the message was never sent.

hugoh avatar Jan 26 '22 00:01 hugoh

Good suggestion, but I think the application should explicitly crash on error. Nevertheless, it should be possible to change this behavior, of course.

I will leave the current error behavior, but add to the configuration the ability to configure retries on error, e.g.

telegram:
  chat_id: 123
  token: abc
  send_retries: 5 # new, 0 by default
  send_retry_interval: 10000 # new

Your PR and issue is a great excuse to shake the dust off this project, thanks!

mxseev avatar Jan 26 '22 01:01 mxseev