-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
Hi!
I have been using UseBranchWithServices for quite sometime now and it is great.
I'm using it for multitenancy with IdentityServer4. One branch per tenant.
The problem I have is that I want to create new tenants dynamically without restarting the app.
For example, if I want to add new branches with newly created tenants every 15s, I could do something like this:
Task.Run(async () =>
{
while (true)
{
List<string> oldTenantIds = TenantIds ?? new List<string>();
TenantIds = GetTenants(db);
var tenantIdsToSubscribe = TenantIds.Except(oldTenantIds).ToList();
if (tenantIdsToSubscribe.Count != 0)
foreach (string tenantId in tenantIdsToSubscribe)
app.UseBranchWithServices($"/{tenantId}",
services => GenericServicesConfig(services, db, tenantId),
appBuilder => GenericAppBuilderConfig(appBuilder));
await Task.Delay(15000);
}
});
But this doesn't seem to work.
If I do this on startup without the Task.Run/while(true)/Task.Delay, it works.
Any idea?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels