{"action":"closed","issue":{"url":"https://api.github.com/repos/exciting-io/slack-bot-server/issues/24","repository_url":"https://api.github.com/repos/exciting-io/slack-bot-server","labels_url":"https://api.github.com/repos/exciting-io/slack-bot-server/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/exciting-io/slack-bot-server/issues/24/comments","events_url":"https://api.github.com/repos/exciting-io/slack-bot-server/issues/24/events","html_url":"https://github.com/exciting-io/slack-bot-server/issues/24","id":168685302,"number":24,"title":"Server crashes on boot-up when bad token is included.","user":{"login":"gabeodess","id":65213,"avatar_url":"https://avatars.githubusercontent.com/u/65213?v=3","gravatar_id":"","url":"https://api.github.com/users/gabeodess","html_url":"https://github.com/gabeodess","followers_url":"https://api.github.com/users/gabeodess/followers","following_url":"https://api.github.com/users/gabeodess/following{/other_user}","gists_url":"https://api.github.com/users/gabeodess/gists{/gist_id}","starred_url":"https://api.github.com/users/gabeodess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabeodess/subscriptions","organizations_url":"https://api.github.com/users/gabeodess/orgs","repos_url":"https://api.github.com/users/gabeodess/repos","events_url":"https://api.github.com/users/gabeodess/events{/privacy}","received_events_url":"https://api.github.com/users/gabeodess/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-01T16:19:08Z","updated_at":"2016-08-18T08:52:31Z","closed_at":"2016-08-18T08:52:31Z","body":"Using the advanced example, we loop through the bot tokens in our database and add them before the server starts.  However, if there is a bad token, the whole server crashes.  The server should instead log a warning for the bad token, and continue to boot.\r\n\r\n## Code\r\n```ruby\r\nqueue = SlackBotServer::RedisQueue.new\r\n\r\nserver = SlackBotServer::Server.new(queue: queue)\r\n\r\nserver.on_add do |token|\r\n  VinnyBot.new(token: token)\r\nend\r\n\r\nUser.find_each do |user|\r\n  server.add_bot(user.bot_token) if user.bot_token.present?\r\nend\r\n\r\nserver.start\r\n\r\n```\r\n\r\n## Backtrace\r\n```\r\n2016-08-01T15:59:33.966624+00:00 heroku[slack_server.1]: State changed from crashed to starting\r\n2016-08-01T15:59:39.993589+00:00 heroku[slack_server.1]: Starting process with command `bundle exec rails runner bin/slack_server.rb`\r\n2016-08-01T15:59:40.655054+00:00 heroku[slack_server.1]: State changed from starting to up\r\n2016-08-01T15:59:45.275205+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Starting the New Relic agent in \"production\" environment.\r\n2016-08-01T15:59:45.275246+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the \"production\" section of your newrelic.yml.\r\n2016-08-01T15:59:45.275247+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Reading configuration from config/newrelic.yml (/app)\r\n2016-08-01T15:59:45.280046+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Environment: production\r\n2016-08-01T15:59:45.280080+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : No known dispatcher detected.\r\n2016-08-01T15:59:45.280110+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Application: VG Pizza\r\n2016-08-01T15:59:45.318022+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing deferred Rack::Builder instrumentation\r\n2016-08-01T15:59:45.318166+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Rack::Builder middleware instrumentation\r\n2016-08-01T15:59:45.319382+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Sidekiq instrumentation\r\n2016-08-01T15:59:45.319557+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing ActiveRecord 4+ instrumentation\r\n2016-08-01T15:59:45.332822+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing ActiveJob instrumentation\r\n2016-08-01T15:59:45.345692+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Rails 3+ middleware instrumentation\r\n2016-08-01T15:59:45.346276+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Net instrumentation\r\n2016-08-01T15:59:45.348721+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Redis Instrumentation\r\n2016-08-01T15:59:45.349027+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Rails 4 view instrumentation\r\n2016-08-01T15:59:45.349145+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Rails 4 Controller instrumentation\r\n2016-08-01T15:59:45.349283+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Installing Rails 4 Error instrumentation\r\n2016-08-01T15:59:45.349354+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:45 +0000 slack_server.1 (3)] INFO : Finished instrumentation\r\n2016-08-01T15:59:46.222921+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:46 +0000 slack_server.1 (3)] INFO : Installing Sinatra instrumentation\r\n2016-08-01T15:59:46.310275+00:00 app[slack_server.1]:   User Load (7.2ms)  SELECT  \"users\".* FROM \"users\"  ORDER BY \"users\".\"id\" ASC LIMIT 1000\r\n2016-08-01T15:59:46.334842+00:00 app[slack_server.1]: I, [2016-08-01T15:59:46.334748 #3]  INFO -- :  adding bot <VinnyBot key:xoxb-xxx>\r\n2016-08-01T15:59:46.336049+00:00 app[slack_server.1]: I, [2016-08-01T15:59:46.336001 #3]  INFO -- :  adding bot <VinnyBot key:xoxb-xxx>\r\n2016-08-01T15:59:46.337910+00:00 app[slack_server.1]: I, [2016-08-01T15:59:46.337870 #3]  INFO -- :  adding bot <VinnyBot key:xoxb-xxx>\r\n2016-08-01T15:59:46.339088+00:00 app[slack_server.1]: I, [2016-08-01T15:59:46.339047 #3]  INFO -- :  adding bot <VinnyBot key:xoxb-xxx>\r\n2016-08-01T15:59:46.339577+00:00 app[slack_server.1]: I, [2016-08-01T15:59:46.339538 #3]  INFO -- :  adding bot <VinnyBot key:xoxb-xxx>\r\n2016-08-01T15:59:46.593135+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:46 +0000 slack_server.1 (3)] INFO : Reporting to: https://rpm.newrelic.com/accounts/xxx/applications/xxx\r\n2016-08-01T15:59:48.116231+00:00 app[slack_server.1]: ** [NewRelic][2016-08-01 15:59:48 +0000 slack_server.1 (3)] INFO : Starting Agent shutdown\r\n2016-08-01T15:59:48.251224+00:00 app[slack_server.1]: /app/vendor/bundle/ruby/2.3.0/gems/slack-bot-server-0.4.6/lib/slack_bot_server/bot.rb:181:in `rescue in start': account_inactive (SlackBotServer::Bot::ConnectionError)\r\n2016-08-01T15:59:48.251227+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/slack-bot-server-0.4.6/lib/slack_bot_server/bot.rb:152:in `start'\r\n2016-08-01T15:59:48.251228+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/slack-bot-server-0.4.6/lib/slack_bot_server/server.rb:82:in `block (2 levels) in start'\r\n2016-08-01T15:59:48.251229+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/slack-bot-server-0.4.6/lib/slack_bot_server/server.rb:82:in `each'\r\n2016-08-01T15:59:48.251230+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/slack-bot-server-0.4.6/lib/slack_bot_server/server.rb:82:in `block in start'\r\n2016-08-01T15:59:48.251233+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run_machine'\r\n2016-08-01T15:59:48.251234+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run'\r\n2016-08-01T15:59:48.251234+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/slack-bot-server-0.4.6/lib/slack_bot_server/server.rb:80:in `start'\r\n2016-08-01T15:59:48.251236+00:00 app[slack_server.1]: \tfrom bin/slack_server.rb:26:in `<top (required)>'\r\n2016-08-01T15:59:48.251236+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/runner.rb:60:in `load'\r\n2016-08-01T15:59:48.251237+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/runner.rb:60:in `<top (required)>'\r\n2016-08-01T15:59:48.251238+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:123:in `require'\r\n2016-08-01T15:59:48.251240+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:123:in `require_command!'\r\n2016-08-01T15:59:48.251241+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:90:in `runner'\r\n2016-08-01T15:59:48.251242+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'\r\n2016-08-01T15:59:48.251243+00:00 app[slack_server.1]: \tfrom /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'\r\n2016-08-01T15:59:48.251245+00:00 app[slack_server.1]: \tfrom bin/rails:4:in `require'\r\n2016-08-01T15:59:48.251245+00:00 app[slack_server.1]: \tfrom bin/rails:4:in `<main>'\r\n2016-08-01T15:59:48.398640+00:00 heroku[slack_server.1]: Process exited with status 1\r\n2016-08-01T15:59:48.418994+00:00 heroku[slack_server.1]: State changed from up to crashed\r\n```"}}
{"actor":{"display_login":"lazyatom"}}