Skip to content

Commit 62265ec

Browse files
committed
Reset the peak memory usage for each cronjob in CronjobScheduler::executeCronjobs()
The same reasoning as with the background jobs applies. The `executeCronjobs()` method is the method that performs several a-priori unknown cronjobs and is only used for purpose-built controllers.
1 parent 4d4e748 commit 62265ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ public function executeCronjobs()
6060
SessionHandler::getInstance()->changeUser(new User(null), true);
6161

6262
foreach ($cronjobEditors as $cronjobEditor) {
63+
// Reset the memory usage for each cronjob, allowing to measure each individual
64+
// cronjob's memory usage without a memory-heavy cronjob skewing the numbers for
65+
// the following cronjobs.
66+
if (\PHP_VERSION_ID >= 80200) {
67+
\memory_reset_peak_usage();
68+
}
69+
6370
// mark cronjob as being executed
6471
$cronjobEditor->update([
6572
'state' => Cronjob::EXECUTING,

0 commit comments

Comments
 (0)