Commit f7dd4a82c868cfb5fcaf9e012c0addaeb2d9aa26

Authored by Shuky Dvir
2 parents d89230cf f438aef9
Exists in master and in 1 other branch production

Merge pull request #433 from iFixit/performance-improvements

Huge Performance Improvements
app/controllers/api/v1/stats_controller.rb
... ... @@ -13,7 +13,7 @@ class Api::V1::StatsController < ApplicationController
13 13 stats = {
14 14 :name => @app.name,
15 15 :last_error_time => @last_error_time,
16   - :unresolved_errors => @app.problems.unresolved.count
  16 + :unresolved_errors => @app.unresolved_count
17 17 }
18 18  
19 19 respond_to do |format|
... ...
app/models/app.rb
1 1 class App
  2 + include Comparable
2 3 include Mongoid::Document
3 4 include Mongoid::Timestamps
4   - include Comparable
5 5  
6 6 field :name, :type => String
7 7 field :api_key
... ...
config/application.rb
... ... @@ -48,6 +48,9 @@ module Errbit
48 48 g.fixture_replacement :fabrication
49 49 end
50 50  
  51 + # Enable the mongoid identity map for performance
  52 + Mongoid.identity_map_enabled = true
  53 +
51 54 # IssueTracker subclasses use inheritance, so preloading models provides querying consistency in dev mode.
52 55 config.mongoid.preload_models = true
53 56  
... ...
config/mongoid.example.yml
... ... @@ -9,6 +9,8 @@
9 9  
10 10 defaults: &defaults
11 11 host: localhost
  12 + identity_map_enabled: true
  13 +
12 14 # slaves:
13 15 # - host: slave1.local
14 16 # port: 27018
... ...
config/mongoid.mongohq.yml
... ... @@ -6,3 +6,4 @@
6 6  
7 7 production:
8 8 uri: <%= ENV['MONGOHQ_URL'] %>
  9 + identity_map_enabled: true
... ...
config/mongoid.mongolab.yml
... ... @@ -6,3 +6,4 @@
6 6  
7 7 production:
8 8 uri: <%= ENV['MONGOLAB_URI'] %>
  9 + identity_map_enabled: true
... ...