Skip to content
代码片段 群组 项目
提交 dbaafbd2 编辑于 作者: dotnet-bot's avatar dotnet-bot
浏览文件

Merge in 'release/6.0' changes

No related branches found
No related tags found
无相关合并请求
......@@ -12,9 +12,15 @@ export class BootConfigResult {
loadBootResource('manifest', 'blazor.boot.json', '_framework/blazor.boot.json', '') :
defaultLoadBlazorBootJson('_framework/blazor.boot.json');
const bootConfigResponse = loaderResponse instanceof Promise ?
await loaderResponse :
await defaultLoadBlazorBootJson(loaderResponse ?? '_framework/blazor.boot.json');
let bootConfigResponse: Response;
if (!loaderResponse) {
bootConfigResponse = await defaultLoadBlazorBootJson('_framework/blazor.boot.json');
} else if (typeof loaderResponse === 'string') {
bootConfigResponse = await defaultLoadBlazorBootJson(loaderResponse);
} else {
bootConfigResponse = await loaderResponse;
}
// While we can expect an ASP.NET Core hosted application to include the environment, other
// hosts may not. Assume 'Production' in the absence of any specified value.
......
......@@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.HttpLogging
private bool _maxFilesReached;
private TimeSpan _flushInterval;
private W3CLoggingFields _fields;
private DateTime _today = DateTime.Now;
private DateTime _today;
private bool _firstFile = true;
private readonly IOptionsMonitor<W3CLoggerOptions> _options;
......@@ -40,6 +40,9 @@ namespace Microsoft.AspNetCore.HttpLogging
private readonly Task _outputTask;
private readonly CancellationTokenSource _cancellationTokenSource;
// Internal to allow for testing
internal ISystemDateTime SystemDateTime {get; set;} = new SystemDateTime();
private readonly object _pathLock = new object();
public FileLoggerProcessor(IOptionsMonitor<W3CLoggerOptions> options, IHostEnvironment environment, ILoggerFactory factory)
......@@ -98,6 +101,8 @@ namespace Microsoft.AspNetCore.HttpLogging
}
});
_today = SystemDateTime.Now;
// Start message queue processor
_cancellationTokenSource = new CancellationTokenSource();
_outputTask = Task.Run(ProcessLogQueue);
......@@ -155,7 +160,7 @@ namespace Microsoft.AspNetCore.HttpLogging
private async Task WriteMessagesAsync(List<string> messages, CancellationToken cancellationToken)
{
// Files are written up to _maxFileSize before rolling to a new file
DateTime today = DateTime.Now;
DateTime today = SystemDateTime.Now;
if (!TryCreateDirectory())
{
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.AspNetCore.HttpLogging
{
internal interface ISystemDateTime
{
/// <summary>
/// Retrieves the date and time currently set for this machine.
/// </summary>
DateTime Now { get; }
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.AspNetCore.HttpLogging
{
internal class SystemDateTime : ISystemDateTime
{
public DateTime Now => DateTime.Now;
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.AspNetCore.HttpLogging
{
internal class MockSystemDateTime : ISystemDateTime
{
public DateTime Now { get; set; }
}
}
......@@ -251,7 +251,7 @@ catch
{
var fileName = Guid.NewGuid().ToString("N") + ".sh";
var scriptPath = Path.Combine(AppContext.BaseDirectory, fileName);
var stopScript = @$"function list_child_processes(){{
var stopScript = @$"function list_child_processes () {{
local ppid=$1;
local current_children=$(pgrep -P $ppid);
local local_child;
......@@ -282,7 +282,7 @@ do
done;
rm {scriptPath};
";
File.WriteAllText(scriptPath, stopScript);
File.WriteAllText(scriptPath, stopScript.ReplaceLineEndings());
var stopScriptInfo = new ProcessStartInfo("/bin/bash", scriptPath)
{
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册