Inverse of the EmbedMemory job (#56): removes a memory from Qdrant (and the future Elasticsearch index) when brain_forget fires or a memory is soft-deleted. - php/Jobs/DeleteFromIndex.php — Laravel Job, 3 retries with backoff - BrainService: qdrantDelete() private→public and now throws on HTTP failure (was silent Log::warning — wouldn't trigger Job retry) - elasticDelete() stub added (fills in with the ES integration ticket) - php/tests/Feature/Jobs/DeleteFromIndexTest.php — success + HTTP-failure paths via mocked Http Co-authored-by: Codex <noreply@openai.com> Closes tasks.lthn.sh/view.php?id=57
36 lines
824 B
PHP
36 lines
824 B
PHP
<?php
|
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Core\Mod\Agentic\Jobs;
|
|
|
|
use Core\Mod\Agentic\Services\BrainService;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class DeleteFromIndex implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public int $tries = 3;
|
|
|
|
/**
|
|
* @var array<int, int>
|
|
*/
|
|
public array $backoff = [10, 60, 300];
|
|
|
|
public function __construct(
|
|
public string $memoryId,
|
|
) {}
|
|
|
|
public function handle(BrainService $brain): void
|
|
{
|
|
$brain->qdrantDelete([$this->memoryId]);
|
|
$brain->elasticDelete($this->memoryId);
|
|
}
|
|
}
|