@@ -309,7 +309,7 @@ index c1953d88..61561ba7 100644
309
309
}
310
310
}
311
311
diff --git a/src/Runner.Common/Logging.cs b/src/Runner.Common/Logging.cs
312
- index 9200ca59..a0e6e1da 100644
312
+ index 9200ca59..6fa0decc 100644
313
313
--- a/src/Runner.Common/Logging.cs
314
314
+++ b/src/Runner.Common/Logging.cs
315
315
@@ -1,5 +1,7 @@
@@ -333,26 +333,32 @@ index 9200ca59..a0e6e1da 100644
333
333
}
334
334
335
335
public class PagingLogger : RunnerService, IPagingLogger
336
- @@ -75,93 +75,88 @@ namespace GitHub.Runner.Common
336
+ @@ -70,98 +70,93 @@ namespace GitHub.Runner.Common
337
+ // and the consumer queues it for upload
338
+ // Ensure this is lazy. Create a page on first write
339
+ //
340
+ - public void Write(string message)
341
+ + public async Task WriteAsync(string message)
342
+ {
337
343
// lazy creation on write
338
344
if (_pageWriter == null)
339
345
{
340
346
- NewPage();
341
- + await NewPageAsync(); // Changed to async
347
+ + await NewPageAsync();
342
348
}
343
349
344
350
if (_resultsBlockWriter == null)
345
351
{
346
352
- NewBlock();
347
- + await NewBlockAsync(); // Changed to async
353
+ + await NewBlockAsync();
348
354
}
349
355
350
356
- string line = $"{DateTime.UtcNow.ToString("O")} {message}";
351
357
- _pageWriter.WriteLine(line);
352
358
- _resultsBlockWriter.WriteLine(line);
353
359
+ string line = $"{DateTime.UtcNow:O} {message}";
354
- + await _pageWriter.WriteLineAsync(line); // Changed to async
355
- + await _resultsBlockWriter.WriteLineAsync(line); // Changed to async
360
+ + await _pageWriter.WriteLineAsync(line);
361
+ + await _resultsBlockWriter.WriteLineAsync(line);
356
362
357
363
_totalLines++;
358
364
- if (line.IndexOf('\n') != -1)
@@ -372,18 +378,19 @@ index 9200ca59..a0e6e1da 100644
372
378
+ int bytes = Encoding.UTF8.GetByteCount(line);
373
379
_byteCount += bytes;
374
380
_blockByteCount += bytes;
381
+ +
375
382
if (_byteCount >= PageSize)
376
383
{
377
384
- NewPage();
378
- + await NewPageAsync(); // Changed to async
385
+ + await NewPageAsync();
379
386
}
380
387
381
388
if (_blockByteCount >= BlockSize)
382
389
{
383
390
- NewBlock();
384
- + await NewBlockAsync(); // Changed to async
391
+ + await NewBlockAsync();
385
392
}
386
-
393
+ -
387
394
}
388
395
389
396
- public void End()
@@ -396,10 +403,10 @@ index 9200ca59..a0e6e1da 100644
396
403
}
397
404
398
405
- private void NewPage()
399
- + private async Task NewPageAsync() // Changed to async
406
+ + private async Task NewPageAsync()
400
407
{
401
408
- EndPage();
402
- + await EndPageAsync(); // Changed to async
409
+ + await EndPageAsync();
403
410
_byteCount = 0;
404
411
_dataFileName = Path.Combine(_pagesFolder, $"{_timelineId}_{_timelineRecordId}_{++_pageCount}.log");
405
412
- _pageData = new FileStream(_dataFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
@@ -410,7 +417,7 @@ index 9200ca59..a0e6e1da 100644
410
417
}
411
418
412
419
- private void EndPage()
413
- + private async Task EndPageAsync() // Changed to async
420
+ + private async Task EndPageAsync()
414
421
{
415
422
if (_pageWriter != null)
416
423
{
@@ -428,10 +435,10 @@ index 9200ca59..a0e6e1da 100644
428
435
}
429
436
430
437
- private void NewBlock()
431
- + private async Task NewBlockAsync() // Changed to async
438
+ + private async Task NewBlockAsync()
432
439
{
433
440
- EndBlock(false);
434
- + await EndBlockAsync(false); // Changed to async
441
+ + await EndBlockAsync(false);
435
442
_blockByteCount = 0;
436
443
_resultsDataFileName = Path.Combine(_resultsBlockFolder, $"{_timelineId}_{_timelineRecordId}.{++_blockCount}");
437
444
- _resultsBlockData = new FileStream(_resultsDataFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite);
@@ -442,7 +449,7 @@ index 9200ca59..a0e6e1da 100644
442
449
}
443
450
444
451
- private void EndBlock(bool finalize)
445
- + private async Task EndBlockAsync(bool finalize) // Changed to async
452
+ + private async Task EndBlockAsync(bool finalize)
446
453
{
447
454
if (_resultsBlockWriter != null)
448
455
{
0 commit comments