[xharness] Add a timeout to the periodic command. (#7500)

This will hopefully prevent the periodic command from keeping xharness alive longer than it should.
This commit is contained in:
Rolf Bjarne Kvinge 2019-11-27 09:09:44 -05:00 коммит произвёл GitHub
Родитель 38a3c4ed87
Коммит e86a76e6c7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -1120,14 +1120,13 @@ namespace xharness
async Task ExecutePeriodicCommandAsync (Log periodic_loc)
{
//await Task.Delay (Harness.UploadInterval);
periodic_loc.WriteLine ($"Starting periodic task with interval {Harness.PeriodicCommandInterval.TotalMinutes} minutes.");
while (true) {
var watch = Stopwatch.StartNew ();
using (var process = new Process ()) {
process.StartInfo.FileName = Harness.PeriodicCommand;
process.StartInfo.Arguments = Harness.PeriodicCommandArguments;
var rv = await process.RunAsync (periodic_loc, null);
var rv = await process.RunAsync (periodic_loc, timeout: Harness.PeriodicCommandInterval);
if (!rv.Succeeded)
periodic_loc.WriteLine ($"Periodic command failed with exit code {rv.ExitCode} (Timed out: {rv.TimedOut})");
}