Skip to content

Commit

Permalink
🐛 fix clear cache in install tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti committed Dec 8, 2023
1 parent 482f255 commit 4667e16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Classes/Queue/FileQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FileQueue implements QueueInterface
{
private string $directory;

public function __construct(private int $limit, private bool $compress = true)
public function __construct(private int $limit = 10000, private bool $compress = true)
{
$this->directory = Environment::getVarPath() . '/tx_plussentry_queue/';
if (!file_exists($this->directory)) {
Expand Down
14 changes: 12 additions & 2 deletions Classes/Service/Sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
use Sentry\State\HubInterface;
use Sentry\State\Scope;
use Throwable;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

use function Sentry\captureException;
use function Sentry\configureScope;
use function Sentry\init;
use function Sentry\withScope;

class Sentry implements SingletonInterface
Expand Down Expand Up @@ -61,7 +61,17 @@ protected function setup(): void
*/
public static function getInstance(): self
{
return GeneralUtility::makeInstance(Sentry::class);
if (GeneralUtility::getContainer()->has(Sentry::class)) {
return GeneralUtility::makeInstance(Sentry::class);
}
return GeneralUtility::makeInstance(
Sentry::class,
GeneralUtility::makeInstance(ScopeConfig::class),
GeneralUtility::makeInstance(
ConfigService::class,
GeneralUtility::makeInstance(ExtensionConfiguration::class)
)
);
}

public function getClient(): ?ClientInterface
Expand Down
6 changes: 3 additions & 3 deletions Classes/Transport/TransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace Pluswerk\Sentry\Transport;

use Pluswerk\Sentry\Queue\FileQueue;
use Pluswerk\Sentry\Queue\QueueInterface;
use Sentry\Options;
use Sentry\SentrySdk;
use Sentry\Serializer\PayloadSerializer;
use Sentry\Serializer\PayloadSerializerInterface;
use Sentry\Transport\TransportFactoryInterface;
use Sentry\Transport\TransportInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand All @@ -17,10 +16,11 @@ class TransportFactory implements TransportFactoryInterface
{
public function create(Options $options): TransportInterface
{
$container = GeneralUtility::getContainer();
return new QueueTransport(
$options,
GeneralUtility::makeInstance(PayloadSerializer::class, $options),
GeneralUtility::makeInstance(QueueInterface::class)
GeneralUtility::makeInstance($container->has(QueueInterface::class) ? QueueInterface::class : FileQueue::class),
);
}
}

0 comments on commit 4667e16

Please sign in to comment.