Skip to content

Commit

Permalink
Merge pull request #1207 from adsabs/fix-bootstrap-500-errors
Browse files Browse the repository at this point in the history
Fix bootstrap 500 errors
  • Loading branch information
ehenneken authored Jul 21, 2017
2 parents 620f8c1 + a6a5ea2 commit 1bcb231
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
require.config({
paths: {
'google-analytics': '//www.google-analytics.com/analytics',
'analytics': 'js/components/analytics'
'analytics': 'js/components/analytics',
'jquery': '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min'
},
map: {
'analytics': {
Expand Down
3 changes: 2 additions & 1 deletion src/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
require.config({
paths: {
'google-analytics': '//www.google-analytics.com/analytics',
'analytics': 'js/components/analytics'
'analytics': 'js/components/analytics',
'jquery': '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min'
},
map: {
'analytics': {
Expand Down
4 changes: 2 additions & 2 deletions src/js/apps/discovery/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ define(['config', 'module'], function(config, module) {
}

}).fail(function () {
app.redirect('/500.html');
app.redirect('500.html');
});

}).fail(function() {
Expand All @@ -90,7 +90,7 @@ define(['config', 'module'], function(config, module) {
return
}
// if we failed loading, retry *once again* (and give up eventually)
app.reload('/404.html');
app.reload('404.html');
});

});
Expand Down
19 changes: 10 additions & 9 deletions src/js/mixins/discovery_bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ define([
// XXX:rca - solve this better, through config
var beehive = this.getBeeHive();
var dynConf = this.getObject('DynamicConfig');
var timeout = 3000;

var defer = $.Deferred();

Expand All @@ -103,7 +104,8 @@ define([
pendingReqs--;
if (pendingReqs <= 0) defer.resolve(retVal);
},
type: 'GET'
type: 'GET',
timeout: timeout - 1
};
var redirect_uri = location.origin + location.pathname;

Expand All @@ -125,17 +127,16 @@ define([
});

setTimeout(function() {
if (defer.state() == 'resolved')
return;
defer.reject();
},
3000);
if (defer.state() === 'resolved') {
return;
}
defer.reject();
}, timeout);
}
else {
setTimeout(function() {
defer.resolve({}),
1
});
defer.resolve({});
}, 1);
}
return defer;
},
Expand Down
6 changes: 5 additions & 1 deletion src/js/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ define([
context: {request: request, api: self },
timeout: this.defaultTimeoutInMs,
headers: {},
cache: true, // do not generate _ parameters (let browser cache responses),
cache: true // do not generate _ parameters (let browser cache responses),
};

if (options.timeout) {
opts.timeout = options.timeout;
}

if (this.clientVersion) {
opts.headers['X-BB-Api-Client-Version'] = this.clientVersion;
}
Expand Down

0 comments on commit 1bcb231

Please sign in to comment.