Skip to content

Commit

Permalink
Changed the ServiceVariableSource to be transient so it's never share…
Browse files Browse the repository at this point in the history
…d and there's no concurrency errors. Closes GH-527
  • Loading branch information
jeremydmiller committed Sep 15, 2023
1 parent 2bfa2ac commit feeef61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Http/Wolverine.Http/HttpChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static HttpChain ChainFor<T>(Expression<Action<T>> expression, HttpGraph?
return new HttpChain(call, parent ?? new HttpGraph(new WolverineOptions(), new Container(x =>
{
x.For<JsonSerializerOptions>().Use(new JsonSerializerOptions());
x.For<IServiceVariableSource>().Use(c => c.CreateServiceVariableSource()).Singleton();
x.For<IServiceVariableSource>().Use(c => c.CreateServiceVariableSource()).Transient();
})));
}

Expand All @@ -173,7 +173,7 @@ public static HttpChain ChainFor(Type handlerType, string methodName, HttpGraph?
return new HttpChain(call, parent ?? new HttpGraph(new WolverineOptions(), new Container(x =>
{
x.For<JsonSerializerOptions>().Use(new JsonSerializerOptions());
x.For<IServiceVariableSource>().Use(c => c.CreateServiceVariableSource()).Singleton();
x.For<IServiceVariableSource>().Use(c => c.CreateServiceVariableSource()).Transient();
})));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Wolverine/HostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal static IHostBuilder UseWolverine(this IHostBuilder builder, WolverineOp

services.AddSingleton<IStatefulResource, MessageStoreResource>();

services.AddSingleton(s => s.GetRequiredService<IContainer>().CreateServiceVariableSource());
services.AddTransient(s => s.GetRequiredService<IContainer>().CreateServiceVariableSource());

services.AddSingleton(s =>
{
Expand Down

0 comments on commit feeef61

Please sign in to comment.