diff --git a/server/config/default.yaml b/server/config/default.yaml index 975304e..329a504 100644 --- a/server/config/default.yaml +++ b/server/config/default.yaml @@ -83,3 +83,10 @@ admin: # The default sitspeed.io configuration file that will be merged to all tests. # defaultSitespeedioConfigFile: + +# The number of jobs to keep in the queue +# Depending on how many jobs you run and how much memory +# you have on your Redis/KeyDb instance you can tune this +queue: + removeOnComplete: 200 + removeOnFail: 400 \ No newline at end of file diff --git a/server/src/util/add-test.js b/server/src/util/add-test.js index 85d322f..8c0f46b 100644 --- a/server/src/util/add-test.js +++ b/server/src/util/add-test.js @@ -66,6 +66,10 @@ export async function addTest(request) { const defaultConfig = await getDefaultSitespeedConfiguration(); + // The number of objects to keep in the queue before removal + const removeOnComplete = nconf.get('queue:removeOnComplete') || 200; + const removeOnFail = nconf.get('queue:removeOnFail') || 400; + const userConfig = { browsertime: { browser, @@ -139,8 +143,8 @@ export async function addTest(request) { }, { jobId, - removeOnComplete: 200, - removeOnFail: 400, + removeOnComplete, + removeOnFail, priority } ); @@ -163,6 +167,10 @@ export async function addTestFromAPI( testType, priority ) { + // The number of objects to keep in the queue before removal + const removeOnComplete = nconf.get('queue:removeOnComplete') || 200; + const removeOnFail = nconf.get('queue:removeOnFail') || 400; + const deviceId = get(userConfig, 'browsertime.firefox.android.deviceSerial') || get(userConfig, 'browsertime.chrome.android.deviceSerial'); @@ -199,8 +207,8 @@ export async function addTestFromAPI( const jobConfig = { jobId, - removeOnComplete: 200, - removeOnFail: 400, + removeOnComplete, + removeOnFail, priority: priority || 10 };