Skip to content

Commit

Permalink
Remove AUTOREMOVE_BUILDS_BATCH_SIZE config
Browse files Browse the repository at this point in the history
Instead we will remove builds one at a time.
  • Loading branch information
zackgalbreath committed Oct 8, 2024
1 parent 4f6cfe8 commit 29a9574
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
5 changes: 0 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ DB_PASSWORD=secret
# Should CDash automatically remove old builds?
#AUTOREMOVE_BUILDS=true

# How many builds should CDash try to remove per iteration?
# Consider tweaking this value if you notice the autoremove queries
# are slow to execute.
#AUTOREMOVE_BUILDS_BATCH_SIZE=10

# How long should CDash store parsed input files (in hours?)
# Set to 0 if you do not wish to backup parsed submission files.
#BACKUP_TIMEFRAME=48
Expand Down
19 changes: 7 additions & 12 deletions app/Utils/DatabaseCleanupUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,16 @@ public static function removeBuild($buildid) : void
}

/**
* Call removeBuild() in batches.
* @param array<int>|int $buildid
* Call removeBuild() one at a time.
* @param array<int>|int $buildids
*/
public static function removeBuildChunked($buildid): void
public static function removeBuildChunked($buildids): void
{
if (!is_array($buildid)) {
self::removeBuild($buildid);
if (!is_array($buildids)) {
self::removeBuild($buildids);
}

$batch_size = (int) config('cdash.autoremove_builds_batch_size');
if ($batch_size < 1) {
$batch_size = 1;
}
foreach (array_chunk($buildid, $batch_size) as $chunk) {
self::removeBuild($chunk);
foreach ($buildids as $buildid) {
self::removeBuild($buildid);
usleep(1);
}
}
Expand Down
1 change: 0 additions & 1 deletion config/cdash.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
],
'active_project_days' => env('ACTIVE_PROJECT_DAYS', 7),
'autoremove_builds' => env('AUTOREMOVE_BUILDS', true),
'autoremove_builds_batch_size' => env('AUTOREMOVE_BUILDS_BATCH_SIZE', 10),
'backup_timeframe' => env('BACKUP_TIMEFRAME', 48),
'builds_per_project' => env('BUILDS_PER_PROJECT', 0),
'coverage_dir' => env('CDASH_COVERAGE_DIR', '/cdash/_build/xdebugCoverage'),
Expand Down

0 comments on commit 29a9574

Please sign in to comment.