Skip to content

Commit ee07c86

Browse files
committed
Merge pull request #36 from Symphony-DAS/1.5.0
Fixed failed tasks from not clearing out of task list
2 parents 3b98112 + f5a2666 commit ee07c86

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/symphony-core/Symphony.Core/Controller.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,8 @@ private void Process(ConcurrentQueue<Epoch> epochQueue, EpochPersistor persistor
682682
{
683683
try
684684
{
685+
CompletedEpochTasks.Clear();
686+
685687
ProcessLoop(epochQueue, persistor);
686688
}
687689
finally
@@ -761,7 +763,7 @@ private void ProcessLoop(ConcurrentQueue<Epoch> epochQueue, EpochPersistor persi
761763
// Throw if any previous completed epoch tasks faulted
762764
if (CompletedEpochTasks.Any(t => t.IsFaulted))
763765
{
764-
throw new AggregateException(CompletedEpochTasks.Select(t => t.Exception));
766+
throw new AggregateException(CompletedEpochTasks.Where(t => t.IsFaulted).Select(t => t.Exception));
765767
}
766768

767769
Epoch currentEpoch;

src/symphony-core/Symphony.Core/DAQController.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ protected void Process(bool waitForTrigger)
271271
// pushing the results back through the input pipeline
272272
try
273273
{
274+
OutputTasks.Clear();
275+
InputTasks.Clear();
276+
274277
WillBeginProcessLoop();
275278
ProcessLoop(waitForTrigger);
276279
}
@@ -401,13 +404,9 @@ private void PushIncomingData(IEnumerable<KeyValuePair<IDAQInputStream, IInputDa
401404
// Throw if any previous tasks faulted
402405
if (InputTasks.Any(t => t.IsFaulted))
403406
{
404-
var lookup = InputTasks.ToLookup(t => t.IsFaulted);
405-
var faultedTasks = lookup[true];
406-
InputTasks = lookup[false].ToList();
407-
throw new AggregateException(faultedTasks.Select(t => t.Exception));
407+
throw new AggregateException(InputTasks.Where(t => t.IsFaulted).Select(t => t.Exception));
408408
}
409409

410-
411410
var newTask = InputTasks.Any()
412411
? Task.Factory.ContinueWhenAll(InputTasks.ToArray(),
413412
(tasks) =>
@@ -425,8 +424,6 @@ private void PushIncomingData(IEnumerable<KeyValuePair<IDAQInputStream, IInputDa
425424
}
426425
});
427426

428-
429-
430427
InputTasks = InputTasks.Where(t => !t.IsCompleted).ToList();
431428
InputTasks.Add(newTask);
432429
}
@@ -626,9 +623,8 @@ protected virtual void CommonStop()
626623
}
627624
catch (Exception ex)
628625
{
629-
log.WarnFormat("An output task failed while stopping: {0}", ex);
626+
log.ErrorFormat("An output task failed while stopping: {0}", ex);
630627
}
631-
OutputTasks.Clear();
632628

633629
SetStreamsBackground();
634630
}

0 commit comments

Comments
 (0)