Skip to content

Ship InMemoryConfigProvider #1732

Merged
Tratcher merged 2 commits intomainfrom
tratcher/inmem
May 23, 2022
Merged

Ship InMemoryConfigProvider #1732
Tratcher merged 2 commits intomainfrom
tratcher/inmem

Conversation

@Tratcher
Copy link
Member

Fixes #1713

This ships InMemoryConfigProvider, removes redundant copies, and proposes an update pattern.

@Tratcher Tratcher added this to the YARP 2.0.0 milestone May 23, 2022
@Tratcher Tratcher requested a review from MihaZupan as a code owner May 23, 2022 19:02
@Tratcher Tratcher self-assigned this May 23, 2022
@Tratcher Tratcher requested a review from greenEkatherine May 23, 2022 19:02
Comment on lines +16 to +17
builder.Services.AddSingleton(new InMemoryConfigProvider(routes, clusters));
builder.Services.AddSingleton<IProxyConfigProvider>(s => s.GetRequiredService<InMemoryConfigProvider>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
builder.Services.AddSingleton(new InMemoryConfigProvider(routes, clusters));
builder.Services.AddSingleton<IProxyConfigProvider>(s => s.GetRequiredService<InMemoryConfigProvider>());
builder.Services.AddSingleton<IProxyConfigProvider>(new InMemoryConfigProvider(routes, clusters));

Isn't this equivalent?

Copy link
Member Author

@Tratcher Tratcher May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InMemoryConfigProvider is intentionally registered independently so you can resolve InMemoryConfigProvider and call Update without downcasting.

@Tratcher Tratcher enabled auto-merge (squash) May 23, 2022 20:23
@Tratcher Tratcher merged commit 28a50f1 into main May 23, 2022
@Tratcher Tratcher deleted the tratcher/inmem branch May 23, 2022 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ship InMemoryConfigProvider

3 participants