Scope - forgot to complete some scopes

This commit is contained in:
Stephan
2017-02-14 09:17:24 +01:00
parent 55c5b41693
commit 507d7dd4f0
6 changed files with 21 additions and 12 deletions

View File

@@ -79,10 +79,11 @@ namespace Umbraco.Web.Scheduling
// running on a background task, and Log.CleanLogs uses the old SqlHelper,
// better wrap in a scope and ensure it's all cleaned up and nothing leaks
using (ApplicationContext.Current.ScopeProvider.CreateScope())
using (var scope = ApplicationContext.Current.ScopeProvider.CreateScope())
using (DisposableTimer.DebugDuration<LogScrubber>("Log scrubbing executing", "Log scrubbing complete"))
{
Log.CleanLogs(GetLogScrubbingMaximumAge(_settings));
scope.Complete();
}
return true; // repeat

View File

@@ -85,10 +85,11 @@ namespace Umbraco.Web.Scheduling
// running on a background task, requires its own (safe) scope
// (GetAuthenticationHeaderValue uses UserService to load the current user, hence requires a database)
// (might not need a scope but we don't know really)
using (ApplicationContext.Current.ScopeProvider.CreateScope())
using (var scope = ApplicationContext.Current.ScopeProvider.CreateScope())
{
//pass custom the authorization header
request.Headers.Authorization = AdminTokenAuthorizeAttribute.GetAuthenticationHeaderValue(_appContext);
scope.Complete();
}
var result = await wc.SendAsync(request, token);