Skip to content

Commit

Permalink
Fix sample in ab-testing.md (#2366)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan authored Jan 2, 2024
1 parent 035d438 commit 1bb1827
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docfx/articles/ab-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ app.MapReverseProxy(proxyPipeline =>
// Custom cluster selection
proxyPipeline.Use((context, next) =>
{
context.RequestServices.GetRequiredService<IProxyStateLookup>();
var lookup = context.RequestServices.GetRequiredService<IProxyStateLookup>();
if (lookup.TryGetCluster(ChooseCluster(context), out var cluster))
{
context.ReassignProxyRequest(cluster);
Expand All @@ -24,7 +24,7 @@ app.MapReverseProxy(proxyPipeline =>
proxyPipeline.UseLoadBalancing();
});
private string ChooseCluster(HttpContext context)
string ChooseCluster(HttpContext context)
{
// Decide which cluster to use. This could be random, weighted, based on headers, etc.
return Random.Shared.Next(2) == 1 ? "cluster1" : "cluster2";
Expand Down

0 comments on commit 1bb1827

Please sign in to comment.