Skip to content

[stable25] fix(cron): Log long running jobs - #46716

Closed
backportbot[bot] wants to merge 1 commit into
stable25from
backport/45855/stable25
Closed

[stable25] fix(cron): Log long running jobs#46716
backportbot[bot] wants to merge 1 commit into
stable25from
backport/45855/stable25

Conversation

@backportbot

Copy link
Copy Markdown

Backport of PR #45855

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@backportbotbackportbotBot added bug 3. to review Waiting for reviews labels Jul 24, 2024
@ChristophWurstChristophWurst changed the title [stable25] [stable27] fix(cron): Log long running jobs[stable25] fix(cron): Log long running jobsJul 24, 2024
@AndyScherzinger

Copy link
Copy Markdown
Member

@ChristophWurst php 7.4 linter fails (for a reasons I would say):

PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in ./cron.php on line 160
Errors parsing ./cron.php

Comment threadcron.php
Comment on lines +159 to +165
$logLevel = match (true) {
$timeSpent > $cronInterval * 128 => \OCP\ILogger::FATAL,
$timeSpent > $cronInterval * 64 => \OCP\ILogger::ERROR,
$timeSpent > $cronInterval * 16 => \OCP\ILogger::WARN,
$timeSpent > $cronInterval * 8 => \OCP\ILogger::INFO,
default => \OCP\ILogger::DEBUG,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work match was introduced with PHP 8.0 so you need to use switch-case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristophWurst looks like backporting won't be possible here :(

@ChristophWurst

ChristophWurst commented Aug 7, 2024

Copy link
Copy Markdown
Member

@AndyScherzinger@sorbaugh I did not intend to get this merged. @marinofaggiana needed a patch to debug a production system, for which this PR is sufficient as long as it's not used with old PHP. See #45804 (comment).

We can close the PR. 25 is EOL.

@susnuxsusnux closed this Aug 8, 2024
@susnux
susnux deleted the backport/45855/stable25 branch August 8, 2024 00:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@AndyScherzinger@ChristophWurst@susnux@skjnldsv@sorbaugh@marinofaggiana