Cache fixing

dev/git-series/gccdum
Matt Godbolt 8 years ago
parent 1d56b7dacc
commit 8c40df3a7f

@ -49,6 +49,7 @@ var rootDir = opts.rootDir || './etc';
props.initialize(rootDir + '/config', propHierarchy);
var port = props.get('gcc-explorer', 'port', 10240);
var staticMaxAgeMs = props.get('gcc-explorer', 'staticMaxAgeMs', 0);
function loadSources() {
var sourcesDir = "lib/sources";
@ -95,6 +96,7 @@ function getSource(req, res, next) {
return;
}
action.apply(handler, bits.slice(3).concat(function (err, response) {
res.set('Cache-Control', 'public, max-age=' + staticMaxAgeMs);
if (err) {
res.end(JSON.stringify({err: err}));
} else {
@ -161,6 +163,7 @@ function clientOptionsHandler(compilers, fileSources) {
var text = "var OPTIONS = " + JSON.stringify(options) + ";";
return function getClientOptions(req, res) {
res.set('Content-Type', 'application/javascript');
res.set('Cache-Control', 'public, max-age=' + staticMaxAgeMs);
res.end(text);
};
}
@ -212,7 +215,7 @@ findCompilers().then(function (compilers) {
webServer
.use(logger('combined'))
.use(sFavicon('static/favicon.ico'))
.use(sStatic('static'))
.use(sStatic('static', {maxAge: staticMaxAgeMs}))
.use(bodyParser.urlencoded({extended: true}))
.get('/client-options.js', clientOptionsHandler(compilers, fileSources))
.use('/source', getSource)

@ -2,6 +2,7 @@
compileTimeoutMs=2000
compiler-wrapper=./c-preload/compiler-wrapper
max-asm-size=500000
staticMaxAgeMs=600000
cacheMb=300
clientGoogleAnalyticsEnabled=true
compilers=g447:g453:g464:g473:g481:g490:armg453:clang30:avrg453:armg463:icc1301:clang32:clang33:clang341:g490c1:g490c2

@ -10,3 +10,4 @@ cacheMb=200
language=C++
options=-O2
maxConcurrentCompiles=2
staticMaxAgeMs=1000

Loading…
Cancel
Save