From 137685d8833e26a37feebbe02bf62438bbb80558 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Mon, 6 May 2013 15:49:51 -1000 Subject: [PATCH] Updates: #U4-2192 - moves method call to be inside of the lock. --- .../umbraco.presentation/content.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 39d1d5c558..22ceb0b3b1 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -1057,24 +1057,27 @@ namespace umbraco { LogHelper.Debug("Republishing starting"); - // Lets cache the DTD to save on the DB hit on the subsequent use - string dtd = DocumentType.GenerateDtd(); + lock (DbReadSyncLock) + { - // Prepare an XmlDocument with an appropriate inline DTD to match - // the expected content - var xmlDoc = new XmlDocument(); - InitContentDocument(xmlDoc, dtd); + // Lets cache the DTD to save on the DB hit on the subsequent use + string dtd = DocumentType.GenerateDtd(); - // Esben Carlsen: At some point we really need to put all data access into to a tier of its own. - // CLN - added checks that document xml is for a document that is actually published. - string sql = - @"select umbracoNode.id, umbracoNode.parentId, umbracoNode.sortOrder, cmsContentXml.xml from umbracoNode + // Prepare an XmlDocument with an appropriate inline DTD to match + // the expected content + var xmlDoc = new XmlDocument(); + InitContentDocument(xmlDoc, dtd); + + // Esben Carlsen: At some point we really need to put all data access into to a tier of its own. + // CLN - added checks that document xml is for a document that is actually published. + string sql = + @"select umbracoNode.id, umbracoNode.parentId, umbracoNode.sortOrder, cmsContentXml.xml from umbracoNode inner join cmsContentXml on cmsContentXml.nodeId = umbracoNode.id and umbracoNode.nodeObjectType = @type where umbracoNode.id in (select cmsDocument.nodeId from cmsDocument where cmsDocument.published = 1) order by umbracoNode.level, umbracoNode.sortOrder"; - lock (DbReadSyncLock) - { + + using ( IRecordsReader dr = SqlHelper.ExecuteReader(sql, SqlHelper.CreateParameter("@type",