Skip to content

Commit

Permalink
Make removeOnComplete/failure configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Jun 26, 2024
1 parent d2bd6b1 commit e047a02
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
7 changes: 7 additions & 0 deletions server/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 12 additions & 4 deletions server/src/util/add-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -139,8 +143,8 @@ export async function addTest(request) {
},
{
jobId,
removeOnComplete: 200,
removeOnFail: 400,
removeOnComplete,
removeOnFail,
priority
}
);
Expand All @@ -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');
Expand Down Expand Up @@ -199,8 +207,8 @@ export async function addTestFromAPI(

const jobConfig = {
jobId,
removeOnComplete: 200,
removeOnFail: 400,
removeOnComplete,
removeOnFail,
priority: priority || 10
};

Expand Down

0 comments on commit e047a02

Please sign in to comment.