Skip to content

Commit

Permalink
fix: delete catalog implicitly closes sessions on the server side
Browse files Browse the repository at this point in the history
Therefore we need to close them prior deleting the catalog on the client side first.
  • Loading branch information
novoj committed May 9, 2024
1 parent c6c3a05 commit b178f53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions EvitaDB.Client/EvitaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,18 @@ public bool DeleteCatalogIfExists(string catalogName)
{
AssertActive();

// first close and remove all active sessions to particular catalog
List<EvitaClientSession> activeCatalogSessions = _activeSessions.Values
.Where(x => x.CatalogName == catalogName)
.ToList();

foreach (var session in activeCatalogSessions)
{
session.Close();
_activeSessions.Remove(session.SessionId, out _);
}

// then delete it
GrpcDeleteCatalogIfExistsRequest request = new GrpcDeleteCatalogIfExistsRequest { CatalogName = catalogName };
GrpcDeleteCatalogIfExistsResponse grpcResponse =
ExecuteWithBlockingEvitaService(evitaService => evitaService.DeleteCatalogIfExists(request));
Expand Down

0 comments on commit b178f53

Please sign in to comment.