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

"Resetting cached network information" printed for new PackageDependencyReporter and PackageFunctionReporter #70

Closed
jayqi opened this issue Mar 25, 2018 · 0 comments · Fixed by #181
Labels

Comments

@jayqi
Copy link
Collaborator

jayqi commented Mar 25, 2018

Issue: Initializing new PackageDependencyReporter and PackageFunctionReporter and using set_package will result in an unintuitive "Resetting cached network information..." logger statement to be printed.

To reproduce:

> myDepReporter <- PackageDependencyReporter$new()
> myDepReporter$set_package('baseballstats')
INFO [2018-03-25 20:22:31] Resetting cached network information...

and

> myFuncReporter <- PackageFunctionReporter$new()
> myFuncReporter$set_package('baseballstats')
INFO [2018-03-25 20:22:48] Resetting cached network information...

The reason this happens is because the reset_cache method of AbstractPackageReporter is checking whether the cache is null. Both PackageFunctionReporter and PackageDependencyReporter start with cache as a list of several variables with null values.

The more complicated and less flexible way to fix this is to have reset_cache check if cache is a list, and then check whether each value in the list is null. This will not work well if we ever end up having cached fields that initialize as a non-null value.

Another implementation that addresses this is to have cache initialized as null with a new reporter instance, and a template default_cache that the cache gets set/reset to. See implementation in older version here and here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants