Dashboard calculations are done with an async job now

This commit is contained in:
Neil Lalonde
2013-08-02 18:31:25 -04:00
parent 1552c4b69e
commit 98b58150bb
11 changed files with 49 additions and 21 deletions
@@ -42,5 +42,9 @@ Discourse.AdminDashboardController = Ember.Controller.extend({
problemsTimestamp: function() {
return moment(this.get('problemsFetchedAt')).format('LLL');
}.property('problemsFetchedAt')
}.property('problemsFetchedAt'),
updatedTimestamp: function() {
return moment(this.get('updated_at')).format('LLL');
}.property('updated_at')
});
@@ -14,7 +14,7 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
},
fetchDashboardData: function(c) {
if( !c.get('dashboardFetchedAt') || moment().subtract('hour', 1).toDate() > c.get('dashboardFetchedAt') ) {
if( !c.get('dashboardFetchedAt') || moment().subtract('minutes', 30).toDate() > c.get('dashboardFetchedAt') ) {
c.set('dashboardFetchedAt', new Date());
Discourse.AdminDashboard.find().then(function(d) {
if( Discourse.SiteSettings.version_checks ){
@@ -32,7 +32,7 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
c.set('top_referrers', topReferrers);
}
['admins', 'moderators', 'blocked', 'banned', 'top_traffic_sources', 'top_referred_topics'].forEach(function(x) {
['admins', 'moderators', 'blocked', 'banned', 'top_traffic_sources', 'top_referred_topics', 'updated_at'].forEach(function(x) {
c.set(x, d[x]);
});
@@ -276,3 +276,9 @@
</div>
</div>
<div class='clearfix'></div>
<div class="dashboard-stats pull-right">
<div class="pull-right">{{i18n admin.dashboard.last_updated}} {{updatedTimestamp}}</div>
<div class='clearfix'></div>
</div>
<div class='clearfix'></div>