aboutsummaryrefslogtreecommitdiffstats
path: root/cron.php
diff options
context:
space:
mode:
authorJosh <josh.t.richards@gmail.com>2024-05-27 09:19:48 -0400
committerJoas Schilling <coding@schilljs.com>2024-06-11 14:20:57 +0200
commit8ee070cce5491a8f6a93354f0239d9747c2635ed (patch)
treee67ea189b665bb03e60bf957ebf7412f0198ab35 /cron.php
parent81e90ae592ffb48e4420e235729494ebc01b44b4 (diff)
downloadnextcloud-server-8ee070cce5491a8f6a93354f0239d9747c2635ed.tar.gz
nextcloud-server-8ee070cce5491a8f6a93354f0239d9747c2635ed.zip
fix(cron): Log excess memory usage at debug and info levels
Signed-off-by: Josh <josh.t.richards@gmail.com>
Diffstat (limited to 'cron.php')
-rw-r--r--cron.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/cron.php b/cron.php
index 8cd97258003..c51cf91b174 100644
--- a/cron.php
+++ b/cron.php
@@ -163,10 +163,10 @@ Options:
$memoryAfter = memory_get_usage();
$memoryPeakAfter = memory_get_peak_usage();
- if ($memoryAfter - $memoryBefore > 10_000_000) {
- $logger->warning('Used memory grew by more than 10 MB when executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryAfter). ' (before: ' . Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
+ if ($memoryAfter - $memoryBefore > 50_000_000) {
+ $logger->warning('Used memory grew by more than 50 MB when executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryAfter). ' (before: ' . Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
}
- if ($memoryPeakAfter > 300_000_000) {
+ if ($memoryPeakAfter > 300_000_000 && $memoryPeakBefore <= 300_000_000) {
$logger->warning('Cron job used more than 300 MB of ram after executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryPeakAfter) . ' (before: ' . Util::humanFileSize($memoryPeakBefore) . ')', ['app' => 'cron']);
}