Ship production optimization M1-M12.5A: queues, metrics, HTTP observability, and vector search reliability.
Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Traffic;
|
||||
|
||||
use App\Services\Traffic\BotClassifier;
|
||||
use App\Services\Traffic\OnlineVisitorRepository;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class OnlineVisitorIndexReadTest extends TestCase
|
||||
{
|
||||
public function test_all_uses_sscan_and_never_smembers(): void
|
||||
{
|
||||
Redis::shouldReceive('sscan')
|
||||
->once()
|
||||
->andReturn([0, ['visitor-a', 'visitor-b']]);
|
||||
Redis::shouldReceive('get')->twice()->andReturn(null);
|
||||
Redis::shouldReceive('srem')->once();
|
||||
Redis::shouldReceive('smembers')->never();
|
||||
|
||||
$repository = new OnlineVisitorRepository(app(BotClassifier::class));
|
||||
$records = $repository->all();
|
||||
|
||||
$this->assertSame([], $records);
|
||||
}
|
||||
|
||||
public function test_source_does_not_call_smembers_on_the_presence_index(): void
|
||||
{
|
||||
$source = file_get_contents(base_path('app/Services/Traffic/OnlineVisitorRepository.php'));
|
||||
|
||||
$this->assertNotFalse($source);
|
||||
$this->assertStringNotContainsString('smembers', strtolower($source));
|
||||
$this->assertStringContainsString('sscan', strtolower($source));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user