visciang / telegram

Telegram library for the Elixir language
MIT License
204 stars 27 forks source link

`Poller` terminates on `{:error, "Bad Gateway"}` #150

Closed MLNW closed 1 year ago

MLNW commented 1 year ago

It has now happened twice that one of my bots terminates due to an unhandled error condition when starting polling from the Telegram API:

09:53:56.481 [info] Running in polling mode
09:53:56.502 [error] Task #PID<0.1914.0> started from Telegram.Poller terminating
** (MatchError) no match of right hand side value: {:error, "Bad Gateway"}
   (telegram 0.22.3) lib/poller.ex:113: Telegram.Poller.Task.set_polling/1
   (telegram 0.22.3) lib/poller.ex:101: Telegram.Poller.Task.run/2
   (elixir 1.14.2) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
   (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: &Telegram.Poller.Task.run/2
   Args: [D2rBot.Telegram.Bot, "<token>"]

09:53:56.511 [notice] Application d2r_bot exited: shutdown
{"Kernel pid terminated",application_controller,"{application_terminated,d2r_bot,shutdown}"}
Kernel pid terminated (application_controller) ({application_terminated,d2r_bot,shutdown})
Crash dump is being written to: erl_crash.dump...done 

I'm not sure what is happening. Maybe network connection is lost on my side. But I also have no idea how I should tolerate that on my side. I would expect the bot to just stay alive until the network connectivity is back or the Telegram API answers correctly. What do you think?

visciang commented 1 year ago

Yes @MLNW you are right. I see where the issue is, I'll fix it Friday evening. Thank you for the report

visciang commented 1 year ago

@MLNW check out release 0.22.4.

MLNW commented 1 year ago

Thank you very much @visciang, I have updated my bot. If it happens again I'll let you know.