Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/core/src/Redis/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ public function psubscribe(array|string $channels, Closure $callback): void
throw new SocketException('Redis connection is disconnected abnormally.');
}
}

public function __destruct()
{
$this->subscriber->close();
}
}
2 changes: 1 addition & 1 deletion src/foundation/src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract
*
* @var string
*/
public const VERSION = '0.1.5';
public const VERSION = '0.1.6';

/**
* The base path for the Hypervel installation.
Expand Down
12 changes: 12 additions & 0 deletions tests/Core/RedisSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public function testSubscribe()
->twice()
->andReturn($mockChannel);

$mockRedisSubscriber->shouldReceive('close')
->once();

$mockRedisSubscriber->closed = true;

$subscriber = new Subscriber($config, $mockRedisSubscriber);
Expand Down Expand Up @@ -83,6 +86,9 @@ public function testSubscribeThrowsExceptionWhenConnectionClosedAbnormally()
->once()
->andReturn($mockChannel);

$mockRedisSubscriber->shouldReceive('close')
->once();

$mockRedisSubscriber->closed = false;

$subscriber = new Subscriber($config, $mockRedisSubscriber);
Expand Down Expand Up @@ -126,6 +132,9 @@ public function testPsubscribe()
->twice()
->andReturn($mockChannel);

$mockRedisSubscriber->shouldReceive('close')
->once();

$mockRedisSubscriber->closed = true;

$subscriber = new Subscriber($config, $mockRedisSubscriber);
Expand Down Expand Up @@ -164,6 +173,9 @@ public function testPsubscribeThrowsExceptionWhenConnectionClosedAbnormally()
->once()
->andReturn($mockChannel);

$mockRedisSubscriber->shouldReceive('close')
->once();

$mockRedisSubscriber->closed = false;

$subscriber = new Subscriber($config, $mockRedisSubscriber);
Expand Down