Skip to content
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ await CreateNamespaceAsync(surrealClient, surrealDbNamespace, services, ct)
.ConfigureAwait(false);

// 💡 Wait until the Namespace is really created?!
bool nsCreationValidated = false;
while (!ct.IsCancellationRequested)
{
try
{
await surrealClient.Use(surrealDbNamespace.NamespaceName, null!, ct).ConfigureAwait(false);
nsCreationValidated = true;
break;
}
catch
Expand All @@ -144,6 +146,11 @@ await CreateNamespaceAsync(surrealClient, surrealDbNamespace, services, ct)
}
}

if (!nsCreationValidated)
{
throw new DistributedApplicationException($"Namespace '{surrealDbNamespace.Name}' was not created successfully.");
}

foreach (var dbResourceName in surrealDbNamespace.Databases.Keys)
{
if (builder.Resources.FirstOrDefault(n =>
Expand Down
Loading