telegram-bot-ruby icon indicating copy to clipboard operation
telegram-bot-ruby copied to clipboard

Telegram bot becomes unresponsive

Open bleedr opened this issue 7 years ago • 4 comments

I'm using telegram bot to control my application. Unfortunately after some time it becomes unresponsive. Any ideas?

Thread.new{
  	$telebot.listen do |message|
		begin
			if message.chat.id != $config['telebot'][:admin].to_i then
				next
			end
		    $telebot.api.send_message(chat_id: message.chat.id, text: "\u{1F477} Received your message. Processing")
		    $telebot_commands.push(message.text)
		rescue

		end
	end
}

bleedr avatar Dec 29 '17 00:12 bleedr

Are you sure that thread is really alive all the time? If there would be any exception raised the thread would just silently die.

ivanovaleksey avatar Dec 29 '17 12:12 ivanovaleksey

I've added $@ and $! to the rescue so next time I will have more information. I noticed that when this case happens also Kernel.trap( "INT" ) stops working for the rest of the application

bleedr avatar Dec 29 '17 12:12 bleedr

Stopped again, no output from rescue, retry didn't help. Any idea?

bleedr avatar Dec 30 '17 17:12 bleedr

Alright, the work around is to check if the Thread is alive and restart it if not. This kinda means that the thread terminates without any error for some reason, would be nice to find somehow out why no exception is thrown

bleedr avatar Jan 02 '18 13:01 bleedr

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 19 '23 15:02 github-actions[bot]