Makes some updates based on code reviews
This commit is contained in:
@@ -57,7 +57,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
private BPlusTree<int, ContentNodeKit> _localContentDb;
|
||||
private BPlusTree<int, ContentNodeKit> _localMediaDb;
|
||||
private bool _localDbExists;
|
||||
private bool _localContentDbExists;
|
||||
private bool _localMediaDbExists;
|
||||
|
||||
// define constant - determines whether to use cache when previewing
|
||||
// to store eg routes, property converted values, anything - caching
|
||||
@@ -128,14 +129,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
var path = GetLocalFilesPath();
|
||||
var localContentDbPath = Path.Combine(path, "NuCache.Content.db");
|
||||
var localMediaDbPath = Path.Combine(path, "NuCache.Media.db");
|
||||
var localContentDbExists = File.Exists(localContentDbPath);
|
||||
var localMediaDbExists = File.Exists(localMediaDbPath);
|
||||
_localDbExists = localContentDbExists && localMediaDbExists;
|
||||
_localContentDbExists = File.Exists(localContentDbPath);
|
||||
_localMediaDbExists = File.Exists(localMediaDbPath);
|
||||
// if both local databases exist then GetTree will open them, else new databases will be created
|
||||
_localContentDb = BTree.GetTree(localContentDbPath, localContentDbExists);
|
||||
_localMediaDb = BTree.GetTree(localMediaDbPath, localMediaDbExists);
|
||||
_localContentDb = BTree.GetTree(localContentDbPath, _localContentDbExists);
|
||||
_localMediaDb = BTree.GetTree(localMediaDbPath, _localMediaDbExists);
|
||||
|
||||
_logger.Info<PublishedSnapshotService>($"Registered with MainDom, local db exists? {_localDbExists}");
|
||||
_logger.Info<PublishedSnapshotService>($"Registered with MainDom, local content db exists? {_localContentDbExists}, local media db exists? {_localMediaDbExists}");
|
||||
},
|
||||
() =>
|
||||
{
|
||||
@@ -200,11 +200,15 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
var okContent = false;
|
||||
var okMedia = false;
|
||||
|
||||
if (_localDbExists)
|
||||
if (_localContentDbExists)
|
||||
{
|
||||
okContent = LockAndLoadContent(LoadContentFromLocalDbLocked);
|
||||
if (!okContent)
|
||||
_logger.Warn<PublishedSnapshotService>("Loading content from local db raised warnings, will reload from database.");
|
||||
_logger.Warn<PublishedSnapshotService>("Loading content from local db raised warnings, will reload from database.");
|
||||
}
|
||||
|
||||
if (_localMediaDbExists)
|
||||
{
|
||||
okMedia = LockAndLoadMedia(LoadMediaFromLocalDbLocked);
|
||||
if (!okMedia)
|
||||
_logger.Warn<PublishedSnapshotService>("Loading media from local db raised warnings, will reload from database.");
|
||||
|
||||
Reference in New Issue
Block a user