Repository navigation
Fix installing on LiteDB and the first concurrent requests after a start (2.4.x) - #1025
Merged
Merged
Conversation
CreateTables opened a database context before checking the provider. For LiteDB that is a second LiteDatabase on the file the one registered in DI already holds, so the installation failed with "being used by another process". The context is only needed for MongoDB and is now created there. Co-authored-by: support <support@grandnode.com> (cherry picked from commit b136c22)
…nst nulls Backport from #1004, without removing the Database:Singleton option: - LiteDB 5.0.21 publishes an entity mapper before its members are filled, so the first concurrent requests for a type could fail or read objects with missing fields. StartupApplication builds the mappers of all entities, including those of uninstalled plugins, while startup is still single-threaded. The API module does the same for its models. - The gift voucher query by purchased order item and the order query by billing last name no longer throw on LiteDB for a voucher created by hand or an address without a last name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
The LiteDB part of #997 and #1004, for 2.4.x.
Issue
InstallationService.CreateTablesopened a database context before it checked the provider, which on LiteDB is a secondLiteDatabaseon the file the registered one already holds (Fix installing on LiteDB #997).Solution
CreateTablesopens the database context only for MongoDB (Fix installing on LiteDB #997, cherry-picked).LiteDBMapperWarmupbuilds the mappers of everyBaseEntitytype, their nested, base and interface types, while startup is still single-threaded.StartupApplicationcalls it for all entities, those of uninstalled plugins included, and the API module for its models (LiteDbMapperStartup).Not included from #1004: removing the
Database:Singletonoption. It stays on 2.4.x so existing configuration does not change. The time zone, guest save and first-click fixes are already on 2.4.x (#1006).No new resources, settings or migrations. MongoDB installations are not affected.
Breaking changes
None.
Testing
Unit tests pass:
Grand.Business.Checkout.Tests(246),Grand.Data.Tests(89),Grand.Infrastructure.Tests(167),Grand.Module.Api.Tests(41). The two new query tests fail without the null checks.Run on this branch (Release build, Kestrel,
Database__UseLiteDb=true):