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

pathInfoCache: Respect disk cache TTLs #3398 #3403

Merged
merged 2 commits into from Mar 12, 2020

Conversation

roberth
Copy link
Member

@roberth roberth commented Mar 11, 2020

No description provided.

// Past tense, because a path can only be assumed to exists when
// isKnownNow() && didExist()
inline bool didExist() {
return value != 0;
Copy link
Member

Choose a reason for hiding this comment

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

=> nullptr.


PathInfoCacheValue(std::shared_ptr<const ValidPathInfo> value) :
time_point(std::chrono::steady_clock::now()),
value(value) {}
Copy link
Member

Choose a reason for hiding this comment

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

Since we're using C++20 now, constructors for "trivial" data classes can be omitted using designated initializers, e.g.

PathInfoCacheValue { .value = some_value }

and time_point could have a default initializer:

         std::chrono::time_point<std::chrono::steady_clock> time_point = std::chrono::steady_clock::now();

throw InvalidPath("path '%s' is not valid", printStorePath(storePath));
return callback(ref<const ValidPathInfo>(*res));
callback(ref<const ValidPathInfo>(res->value));
Copy link
Member

Choose a reason for hiding this comment

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

Hm, removing the return looks potentially wrong...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it was. The compiler was complaining about return in a void function. I've re-added the return and then it works.

@roberth roberth force-pushed the issue-3398-path-info-cache-ttls branch from 7e6fdb9 to 22e5b50 Compare March 12, 2020 09:27
@roberth roberth force-pushed the issue-3398-path-info-cache-ttls branch from 22e5b50 to 3f55f8a Compare March 12, 2020 09:30
@roberth roberth marked this pull request as ready for review March 12, 2020 09:31
@roberth
Copy link
Member Author

roberth commented Mar 12, 2020

Ready for review. I'll make a PR with the previous variation for a 2.3 backport.

@roberth roberth changed the title Issue 3398 path info cache ttls pathInfoCache: Respect disk cache TTLs #3398 Mar 12, 2020
@edolstra edolstra merged commit d048577 into NixOS:master Mar 12, 2020
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

2 participants