Skip to content

Site returns no data if an import failed #383

Description

@tdooner

We were getting a bunch of errors like:

2015-02-18T03:34:58.430953+00:00 app[web.1]: 12.250.181.178 - - [18/Feb/2015 03:34:58] "GET /api/category_contributions HTTP/1.1" 500 - 0.0599
2015-02-18T03:34:58.431610+00:00 app[web.1]: NoMethodError - undefined method `import_time' for nil:NilClass:
2015-02-18T03:34:58.431619+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
2015-02-18T03:34:58.446237+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
2015-02-18T03:34:58.446242+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
2015-02-18T03:34:58.446245+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
2015-02-18T03:34:58.431629+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
2015-02-18T03:34:58.431630+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
2015-02-18T03:34:58.431633+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
2015-02-18T03:34:58.431638+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
2015-02-18T03:34:58.446243+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
2015-02-18T03:34:58.446246+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/deflater.rb:25:in `call'
2015-02-18T03:34:58.446251+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
2015-02-18T03:34:58.446253+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
2015-02-18T03:34:58.446254+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
2015-02-18T03:34:58.446255+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
2015-02-18T03:34:58.431641+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
2015-02-18T03:34:58.431644+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
2015-02-18T03:34:58.431642+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
2015-02-18T03:34:58.446211+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
2015-02-18T03:34:58.431632+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
2015-02-18T03:34:58.446217+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'

This would happen if a nightly import failed such that there were no records in the imports table. We use that table to determine cache headers, so it's not exactly crucially important to have data in it. At any rate, we should add better health checking so we are alerted in this case and more-graceful failure modes (because it's likely we could have displayed more data in this case.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions