Skip to content

Commit 4d21d35

Browse files
committed
Change ApiGatewayClient and PermissionsClient to scoped
Updated service provider bindings to use scoped lifetime for ApiGatewayClient and PermissionsClient instead of singleton. This ensures a new instance per request, which may be necessary for correct dependency resolution or request-specific state.
1 parent e9380cc commit 4d21d35

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Providers/MicroserviceServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public function register(): void
3737
);
3838

3939
$this->app->singleton(ApiGatewayClientFactory::class, fn () => new ApiGatewayClientFactory());
40-
$this->app->singleton(ApiGatewayClient::class, fn () => ApiGatewayClient::make());
40+
$this->app->scoped(ApiGatewayClient::class, fn () => ApiGatewayClient::make());
4141
$this->app->bind(ApiGatewayClientInterface::class, fn ($app) => $app->make(ApiGatewayClientFactory::class)->default());
42-
$this->app->singleton(PermissionsClient::class, fn ($app) => new PermissionsClient($app->make(ApiGatewayClientInterface::class)));
42+
$this->app->scoped(PermissionsClient::class, fn ($app) => new PermissionsClient($app->make(ApiGatewayClientInterface::class)));
4343
$this->app->singleton(AuthServiceClient::class, fn () => new AuthServiceClient());
4444
}
4545

0 commit comments

Comments
 (0)