Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure the instance is in maintenance mode before reseting opcache… #34143

Conversation

ativarsoft
Copy link

opcache_reset was being called when there is an update available but the user has not upgraded yet so the instance gets awfully slow if it can be upgraded somehow. This patch ensures that the instance is in maintenance mode. It means that the administrator of the instance is expecting and wants an upgrade.

@ativarsoft ativarsoft marked this pull request as ready for review September 19, 2022 18:09
… and upgrading.

Signed-off-by: Mateus de Lima Oliveira <mateus@ativarsoft.com>
@szaimen szaimen added the 3. to review Waiting for reviews label Sep 21, 2022
@szaimen szaimen added this to the Nextcloud 26 milestone Sep 21, 2022
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍 makes sense

@@ -973,10 +973,10 @@ public static function handleRequest() {
self::checkMaintenanceMode($systemConfig);

if (\OCP\Util::needUpgrade()) {
if (function_exists('opcache_reset')) {
opcache_reset();
}
if (!((bool) $systemConfig->getValue('maintenance', false))) {
Copy link
Contributor

@come-nc come-nc Nov 7, 2022

Choose a reason for hiding this comment

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

Am I reading that wrong or is that if the instance is NOT in maintenance mode?

Copy link
Contributor

Choose a reason for hiding this comment

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

!false === true
I think it is correct

Copy link
Contributor

@artonge artonge Nov 7, 2022

Choose a reason for hiding this comment

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

Correction, confused, but you are right

Copy link
Member

@icewind1991 icewind1991 Nov 11, 2022

Choose a reason for hiding this comment

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

I believe come was right here, the false is just the default, so this reads

$maintenanceEnabled =  $systemConfig->getValue('maintenance', false);
if (!$maintenanceEnabled) {
}

This makes sense since the printUpgradePage will get called if an upgrade needs to be ran but hasn't started yet (that enabled maintenance mode).

I'm not sure this change even makes sense, needUpgrade only returns true if the source has been upgraded, but the nextcloud upgrade hasn't ran yet. So the instance is already "down" in that case

Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

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

explain

@come-nc
Copy link
Contributor

come-nc commented Nov 7, 2022

No offense intended @ativarsoft , I realize the gif looks a bit agressive. Was supposed to be funny.

The question is do you agree the if says the opposite of your PR description?
Did you test your PR and is it having a positive effect for you?
Is the code wrong or the description, or am I wrong?

@ativarsoft
Copy link
Author

The code and the description are both correct and I've been running that code for a while now without any problems. I changed it before the last update on stable so this code is proven to work. I should have written my description more clearly. Sorry.

@blizzz blizzz mentioned this pull request Feb 1, 2023
@skjnldsv skjnldsv mentioned this pull request Feb 23, 2023
@blizzz blizzz mentioned this pull request Mar 7, 2023
@blizzz
Copy link
Member

blizzz commented Mar 9, 2023

Any reason this PR is against stable24? Do we have a equivalent for master?

@blizzz blizzz removed this from the Nextcloud 26 milestone Mar 9, 2023
@blizzz
Copy link
Member

blizzz commented Jun 22, 2023

closing for inactivity

@blizzz blizzz closed this Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants