question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Config reload not occuring

See original GitHub issue

Description

When you set the TimeSpan to reload the configuration in the sample, the configuration does not reload.

Reproduction Steps

  1. Run the sample code, with timespans placed in for reload of configuration. Provide an override level in the configuration:

config.AddSystemsManager($"/dotnet-aws-samples/systems-manager-sample/common", new System.TimeSpan(0, 0, 5) ); config.AddSystemsManager($"/dotnet-aws-samples/systems-manager-sample/{env.EnvironmentName}", new System.TimeSpan(0, 0, 5) );

The reload of 5 seconds never happens if I update the value of environment named configurations.

It seems that if I replace the IOptions with IOptionsSnapshot, the reload works.

I am not sure if this is a change in dotnet core or not, but it no longer seems to work.

Environment

  • Build Version: 2.1.1
  • OS Info: OSX - 10.15.7
  • Build Environment: VSCode
  • Targeted .NET Platform: 2.1 (according to sample) but we see same results in 5.0

Resolution

I guess the sample should be upgraded to use IOptionsSnapshot and maybe some documentation around that. Overall, the configuration management still works, but there is a bit of a rabbit hole to figure out the solution. I can for and create a PR if you like.


This is a 🐛 bug-report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
KenHundleycommented, Jul 28, 2021

Hey @jsauter, that’s intended behavior.

You can see the details for IOptions and IOptionsSnapshot at Options pattern in ASP.NET Core

Specifically the lines:

IOptions<TOptions>:

  • Does not support:
    • Reading of configuration data after the app has started. This is because it’s a singleton that’s only populated once

IOptionsSnapshot<TOptions>:

  • Use IOptionsSnapshot to read updated data.
1reaction
Kralizekcommented, May 10, 2023

@ashishdhingra great finding about the scope in the console application!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Config reload not working?!
Reloading the config will not work. The command name is /thorr (yes /thorr works, it works with the other commands).
Read more >
VuePress not hot reloading, but does when config.js is ...
md files isn't triggering live reloading. If I update the .vuepress/config.js my browser does reload. If I run: vuepress dev --debug.
Read more >
I3 config reload not working - i3wm
Hi guys i have a shortcut for the i3 config reload , but the strange thing is if i try to reload my...
Read more >
Reloading the Config File | Logstash Reference [8.9]
During automatic config reloading, the JVM is not restarted. The creating and swapping of pipelines all happens within the same process.
Read more >
Nginx config reload without downtime
Run service nginx reload or /etc/init.d/nginx reload. It will do a hot reload of the configuration without downtime.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found