You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cron service runs a task to refresh stats every 2 hours but stats regeneration is failing because an exception thrown by Poll::Stats total_web_white method.
It seems current code in trying to access a method of nil object so an exception is thrown.
The mentioned rake task is:
rake stats:generate
Why is this Needed?
To be able update polls stats every 2 hours.
Description
Type: Bug
Here is the exception thrown by cron service:
ake aborted!
NoMethodError: undefined method `title' for nil:NilClass
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:49:in `total_web_white'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (3 levels) in stats_cache'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:113:in `block in fetch'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `block in instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:112:in `fetch'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:133:in `stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (2 levels) in stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:41:in `total_web_valid'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (3 levels) in stats_cache'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:113:in `block in fetch'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `block in instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:112:in `fetch'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:133:in `stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (2 levels) in stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:30:in `block (2 levels) in <class:Stats>'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (3 levels) in stats_cache'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:113:in `block in fetch'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `block in instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:112:in `fetch'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:133:in `stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (2 levels) in stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:21:in `total_participants'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (3 levels) in stats_cache'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:113:in `block in fetch'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `block in instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:371:in `instrument'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:112:in `fetch'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/poll/stats.rb:133:in `stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:184:in `block (2 levels) in stats_cache'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:14:in `block in generate'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:14:in `each'
/aytomad/app/participa/participacion/releases/20190718153714/app/models/concerns/statisticable.rb:14:in `generate'
/aytomad/app/participa/participacion/releases/20190718153714/lib/tasks/stats.rake:12:in `block (3 levels) in <top (required)>'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:59:in `block (2 levels) in find_each'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:59:in `each'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:59:in `block in find_each'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:121:in `block in find_in_batches'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:214:in `block in in_batches'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:198:in `loop'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:198:in `in_batches'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:120:in `find_in_batches'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/relation/batches.rb:58:in `find_each'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.7.2/lib/active_record/querying.rb:9:in `find_each'
/aytomad/app/participa/participacion/releases/20190718153714/lib/tasks/stats.rake:11:in `block (2 levels) in <top (required)>'
/aytomad/app/participa/participacion/shared/bundle/ruby/2.3.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `load'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:27:in `run'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/cli.rb:335:in `exec'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/cli.rb:20:in `dispatch'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/cli.rb:11:in `start'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/exe/bundle:32:in `block in <top (required)>'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/gems/bundler-1.14.3/exe/bundle:24:in `<top (required)>'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/bin/bundle:22:in `load'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/bin/bundle:22:in `<main>'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:15:in `eval'
/aytomad/app/participa/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:15:in `<main>'
Current Behavior
The rake task fails when invoked through cron system service so stats are not updated.
Expected Behavior
The rake task is executed successfully and stats are refreshed.
User Story
Cron service runs a task to refresh stats every 2 hours but stats regeneration is failing because an exception thrown by Poll::Stats
total_web_white
method.It seems current code in trying to access a method of nil object so an exception is thrown.
The mentioned rake task is:
Why is this Needed?
To be able update polls stats every 2 hours.
Description
Type: Bug
Here is the exception thrown by cron service:
Current Behavior
The rake task fails when invoked through cron system service so stats are not updated.
Expected Behavior
The rake task is executed successfully and stats are refreshed.
Steps to reproduce
Re-run rake task used to refresh stats:
Definition of Done
Stats are refreshed when rake task is invoked through system cron service.
The text was updated successfully, but these errors were encountered: