private void Save(IEnumerable <string> channels) { _tc?.Save(); foreach (var sideEffectSaver in _mx.GetSavers(channels)) { sideEffectSaver.SaveInternal(); } }
public void Dispatch(Pipeline queue, ActionsQueue postSave) { do { HashSet <string> usedChannels = new HashSet <string>(); if (queue.HasEffects) { RunCommands(queue.GetEffects(), usedChannels); Stopwatch sw = null; Exception thrown = null; try { if (_traceCollector != null && _traceCollector.Profiling) { sw = new Stopwatch(); sw.Start(); } Save(usedChannels); } catch (Exception ex) { thrown = ex; throw new TectureSaveException(ex); } finally { if (sw != null) { sw.Stop(); } _traceCollector?.Save(sw?.Elapsed ?? TimeSpan.Zero, thrown); } } else { _traceCollector?.Save(TimeSpan.Zero, null); } postSave?.Run(); } while (queue.HasEffects); }
private void Save(IEnumerable <string> channels) { _tc?.Save(); var trans = _transactionManager.GetSaveTransactions(channels, false); List <Exception> aggregate = new List <Exception>(); try { foreach (var sideEffectSaver in _mx.GetSavers(channels)) { sideEffectSaver.SaveInternal(); trans[sideEffectSaver.Channel.FullName].Commit(); } } catch (Exception e) { aggregate.Add(e); } finally { foreach (var channelTransaction in trans) { try { channelTransaction.Value.Dispose(); } catch (Exception e) { aggregate.Add(e); } } } if (aggregate.Count > 0) { throw new AggregateException(aggregate); } }