Skip to content

Commit

Permalink
エンコードに失敗したときの動作を改善
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopanda committed May 4, 2019
1 parent 75360f7 commit fd0abf4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion AmatsukazeServer/Server/TranscodeWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,20 @@ await Task.WhenAll(
if (item.IsTest)
{
// 出力ファイルを削除
File.Delete(dstpath + ext);
for(int retry = 0; ; ++retry)
{
// 終了直後は消せないことがあるので、リトライする
try
{
File.Delete(dstpath + ext);
break;
}
catch(IOException)
{
if (retry > 10) throw;
await Task.Delay(3000);
}
}
}

if (item.State == QueueState.Canceled)
Expand Down Expand Up @@ -1412,6 +1425,11 @@ public async Task<bool> RunItem(QueueItem workerItem, bool forceStart)
catch (Exception e)
{
await server.FatalError(Id, "エンコード中にエラー", e);
if(item != null)
{
item.State = QueueState.Failed;
await server.NotifyQueueItemUpdate(item);
}
return false;
}
finally
Expand Down

0 comments on commit fd0abf4

Please sign in to comment.