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

Lazily create content and models in NuCache #6346

Conversation

Shazwazza
Copy link
Contributor

This is primarily to resolve issues when schema type changes are made (i.e. content types and data types) which until this PR would result in PureLive models being rebuild dozens of times and since package install/uninstall performs many of these changes and restarts, these operations would cause all sorts of odd problems due to the amount of PureLive models being rebuilt.

With this change, the creation of the models (calls to CreateModel) are done lazily so only when the content is actually request. In theory this means that in the ContentTypeCacheRefresher and DataTypeCacheRefresher we wouldn't need to explicitly call WithSafeLiveFactory to re-compile the models eagerly, instead we would just leave the re-compilation to execute lazily when the models are needed.

Some investigation is needed with this PR to ensure that it works as anticipated. One thing we'll need to think about is that even though we then shouldn't call WithSafeLiveFactory eagerly when schema types change, this call used to call the Refresh method of the PureLiveFactory (see https://github.com/zpqrtbnk/Zbu.ModelsBuilder/blob/v8/dev/src/Umbraco.ModelsBuilder/Umbraco/PureLiveModelFactory.cs#L81) which would do both ResetModels + EnsureModels, whereas if we don't call this and only rely on the CreateModel call to ensure models, it only ends up calling EnsureModels and not also ResetModels... need to figure out if that is a required call or not.

@Shazwazza Shazwazza changed the base branch from v8/dev to v8/bugfix/AB2684-purelive-model-regen September 16, 2019 01:47
@Shazwazza Shazwazza marked this pull request as ready for review September 16, 2019 01:48
@Shazwazza Shazwazza merged commit 84fcd30 into umbraco:v8/bugfix/AB2684-purelive-model-regen Sep 16, 2019
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.

1 participant