From f4e3fd6deb52263ba160003108db154e4098f6dd Mon Sep 17 00:00:00 2001 From: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> Date: Wed, 1 Jul 2026 19:35:08 +0200 Subject: [PATCH] fix: wait for app config cache to refresh before running async broacast Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> --- lib/Command/CirclesCheck.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Command/CirclesCheck.php b/lib/Command/CirclesCheck.php index 365105aa0..c4d113f57 100644 --- a/lib/Command/CirclesCheck.php +++ b/lib/Command/CirclesCheck.php @@ -10,6 +10,7 @@ use Exception; use OC\Core\Command\Base; +use OC\Memcache\APCu; use OCA\Circles\AppInfo\Application; use OCA\Circles\AppInfo\Capabilities; use OCA\Circles\Exceptions\FederatedEventException; @@ -39,6 +40,7 @@ use OCA\Circles\Tools\Traits\TNCRequest; use OCA\Circles\Tools\Traits\TStringTools; use OCP\IAppConfig; +use OCP\IConfig; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -67,6 +69,7 @@ class CirclesCheck extends Base { public function __construct( private Capabilities $capabilities, private IAppConfig $appConfig, + private IConfig $config, private InterfaceService $interfaceService, private FederatedEventService $federatedEventService, private RemoteService $remoteService, @@ -262,6 +265,17 @@ private function testLoopback(InputInterface $input, OutputInterface $output): b return false; } + $localIsApcu = ltrim($this->config->getSystemValueString('memcache.local'), '\\') === '\OC\Memcache\APCu'; + if ($localIsApcu) { + /* + * APCu cache is not shared between the CLI process and web requests, so freshly + * set values will either be missing or stale and make the check fail. + * The amount of seconds slept here depends on the TTL set by the AppConfig. + */ + $output->writeln('- Waiting for APCu config cache to refresh (4s)'); + sleep(4); + } + if (!$this->testRequest( $output, 'POST', 'circles.EventWrapper.asyncBroadcast', ['token' => 'test-dummy-token']