Skip to content

Commit

Permalink
fixup! feat: Add task processing API
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Jun 7, 2024
1 parent 94e1ff9 commit 813d72d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions appinfo/register_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

declare(strict_types=1);

use OCA\AppAPI\Db\Console\ExAppOccCommand;
use OCA\AppAPI\Service\ExAppOccService;
use OCP\IConfig;
use OCP\Server;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Application as SymfonyApplication;

use OCP\Server;
use OCP\IConfig;
use OCA\AppAPI\Service\ExAppOccService;
use OCA\AppAPI\Db\Console\ExAppOccCommand;

try {
$config = Server::get(IConfig::class);
$serverContainer = Server::get(ContainerInterface::class);
Expand Down
8 changes: 3 additions & 5 deletions lib/Service/ProvidersAI/TaskProcessingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function registerExAppTaskProcessingProviders(IRegistrationContext $conte
$exAppsProviders = $this->getRegisteredTaskProcessingProviders();
foreach ($exAppsProviders as $exAppProvider) {
$className = '\\OCA\\AppAPI\\' . $exAppProvider->getAppId() . '\\' . $exAppProvider->getName();
$provider = $this->getAnonymousExAppProvider($exAppProvider, $className);
$provider = $this->getAnonymousExAppProvider($exAppProvider);
$context->registerService($className, function () use ($provider) {
return $provider;
});
Expand All @@ -140,17 +140,15 @@ public function registerExAppTaskProcessingProviders(IRegistrationContext $conte
*/
private function getAnonymousExAppProvider(
TaskProcessingProvider $provider,
string $className,
): IProvider {
return new class($provider, $className) implements IProvider {
return new class($provider) implements IProvider {
public function __construct(
private readonly TaskProcessingProvider $provider,
private readonly string $className,
) {
}

public function getId(): string {
return $this->className;
return $this->provider->getName();
}

public function getName(): string {
Expand Down

0 comments on commit 813d72d

Please sign in to comment.