Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable fading of live speed #4497

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open

Conversation

nilsnolde
Copy link
Member

supersedes #4340

@johannes-no, I had to open another PR to finish this, your fork wasn't editable. I just added the review comments so we can merge this. I'd soon like to release.

@johannes-no
Copy link
Contributor

Okay thanks a lot @nilsnolde! We will revise our merg process again so that this will hopefully no longer happen in the future. In addition, we have encountered further problems with the Config Singleton which we are currently fixing and then contributing, so unfortunately this story had less priority. It was my mistake not to make you aware of this earlier.

@nilsnolde
Copy link
Member Author

No worries, we're happy to have this change as it was a bit of an opinionated constant.

@@ -388,18 +381,18 @@ boost::property_tree::ptree make_config(const std::string& path_prefix,
// force the paths to be different
boost::replace_all(defaults, "%%", path_prefix);

// make ptree and override defaults
Copy link
Member Author

Choose a reason for hiding this comment

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

this should be fine, nothing really changed

Copy link
Member

Choose a reason for hiding this comment

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

yeah config singleton is a double edged sword. on one hand using makes life way easier for 99.99% of all use-cases. but then in testing, if we need to change the configs to test something and the singleton is used throughout the library it will be a gotcha. im all for crossing that bridge when we get there (i have an idea for how to make it work)

Copy link
Member Author

Choose a reason for hiding this comment

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

for tests I think it's fine though right? bcs we can change things with overrides & removes when we call make_config.

Copy link
Member

Choose a reason for hiding this comment

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

once there are calls to the config singleton embedded deep in the library code, a test wont be able to control which which one it will get. it will always get the first config it was called with. so in the future when that is a problem we'll need a way to inject a change overtop of the singletons initial copy

@nilsnolde
Copy link
Member Author

hmpf, adding the config singleton to the graphtile results in many more changes than I'd have liked.. basically anything calling GetSpeed needs to have the singleton initiated now..

@johannes-no
Copy link
Contributor

Yes exactly, we would have to adapt many places. That's why we had implemented the try here in the initial merg request. How should we proceed now?

@nilsnolde
Copy link
Member Author

I'd just bite the bullet and do all those changes. Would have to be done eventually anyways. It's a bit annoying but not the end of the world. The actual PR is just a few lines, so all those changes won't distract too much.

@@ -57,7 +50,7 @@ struct config_singleton_t {
config_singleton_t() = delete;
config_singleton_t(const std::string& config_file_or_inline) {
if (config_file_or_inline.empty()) {
throw valhalla::ConfigUninitializedException();
throw std::runtime_error("Config singleton was not initialized before usage");
Copy link
Member

Choose a reason for hiding this comment

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

much better

@nilsnolde
Copy link
Member Author

FFS I'm really sick of compiler bullshit.. with gcc 13.2.1 a Release build fails for utrecht_tiles with

2024/01/17 22:06:39.208672 [INFO] Creating shortcuts on level 1
terminate called after throwing an instance of 'std::runtime_error'
  what():  Config singleton was not initialized before usage

which of course isn't valid, at this point the singleton is configured by valhalla_build_tiles. and again, I just add a little log line in config.h and it passes that stage easily. then it segfaults for some in RestrictionBuilder, but that's of secondary concern.. sounds very similar to the bullshit error in #4500

@kevinkreiser
Copy link
Member

yeah seems like something is systemically wrong.. i wonder if we are suffering from something more exotic like the initialization fiasco: https://en.cppreference.com/w/cpp/language/siof

i dont think so because we always use the "construct on first use" idiom in our singletons but this kind of gotcha seems to be whats happening to us

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.

None yet

3 participants