Skip to content

Commit a11262b

Browse files
Merge pull request #45530 from nextcloud/jtr/fix-cron-memory-usage-levels
fix(cron): Log excess memory usage at debug and info levels
2 parents b3e4270 + ecef392 commit a11262b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cron.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@
182182
);
183183
}
184184

185-
if ($memoryAfter - $memoryBefore > 10_000_000) {
186-
$logger->warning('Used memory grew by more than 10 MB when executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryAfter). ' (before: ' . Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
185+
if ($memoryAfter - $memoryBefore > 50_000_000) {
186+
$logger->warning('Used memory grew by more than 50 MB when executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryAfter). ' (before: ' . Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
187187
}
188-
if ($memoryPeakAfter > 300_000_000) {
188+
if ($memoryPeakAfter > 300_000_000 && $memoryPeakBefore <= 300_000_000) {
189189
$logger->warning('Cron job used more than 300 MB of ram after executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryPeakAfter) . ' (before: ' . Util::humanFileSize($memoryPeakBefore) . ')', ['app' => 'cron']);
190190
}
191191

0 commit comments

Comments
 (0)