private async Task WriteOutput(EksCreateJobOutputEntity e)
        {
            await using (_ContentDbContext.BeginTransaction())
            {
                await _ContentDbContext.AddAsync(e);

                _ContentDbContext.SaveAndCommit();
            }
        }
Exemplo n.º 2
0
        private async Task WriteNewEksToOutput()
        {
            _Logger.LogDebug("Build EKS.");

            var args = _Output.Select(Map).ToArray();

            var content = await _SetBuilder.BuildAsync(args);

            var e = new EksCreateJobOutputEntity
            {
                Region  = DefaultValues.Region,
                Release = _EksEngineResult.Started,
                CreatingJobQualifier = ++_EksCount,
                Content = content,
            };

            _Logger.LogInformation("Write EKS - Id:{CreatingJobQualifier}.", e.CreatingJobQualifier);


            await using (var dbc = _PublishingDbContextFac())
            {
                await using var tx = dbc.BeginTransaction();
                await dbc.AddAsync(e);

                dbc.SaveAndCommit();
            }

            _Logger.LogInformation("Mark TEKs as used.");

            foreach (var i in _Output)
            {
                i.Used = true;
            }

            //Could be 750k in this hit
            await using (var dbc2 = _PublishingDbContextFac())
            {
                var bargs = new SubsetBulkArgs
                {
                    PropertiesToInclude = new[] { nameof(EksCreateJobInputEntity.Used) }
                };
                await dbc2.BulkUpdateAsync2(_Output, bargs); //TX
            }

            _EksEngineResult.OutputCount += _Output.Count;

            var now = _DateTimeProvider.Now();

            _EksResults.Add(new EksInfo {
                TekCount = _Output.Count, TotalSeconds = (now - _StartEks).TotalSeconds
            });
            _Output.Clear();
            _StartEks = now;
        }
        private async Task WriteOutput(EksCreateJobOutputEntity e)
        {
            _Logger.LogInformation($"Write EKS {e.CreatingJobQualifier}.");

            await using (_PublishingDbContext.BeginTransaction())
            {
                await _PublishingDbContext.AddAsync(e);

                _PublishingDbContext.SaveAndCommit();
            }
        }
Exemplo n.º 4
0
        private async Task WriteNewEksToOutputAsync()
        {
            _Logger.WriteBuildEntry();

            var args = _Output.Select(Map).ToArray();

            var content = await _SetBuilder.BuildAsync(args);

            var e = new EksCreateJobOutputEntity
            {
                Region  = DefaultValues.Region,
                Release = _EksEngineResult.Started,
                CreatingJobQualifier = ++_EksCount,
                Content = content,
            };

            _Logger.WriteWritingCurrentEks(e.CreatingJobQualifier);


            await using (var dbc = _PublishingDbContextFac())
            {
                await using var tx = dbc.BeginTransaction();
                await dbc.AddAsync(e);

                dbc.SaveAndCommit();
            }

            _Logger.WriteMarkTekAsUsed();

            foreach (var i in _Output)
            {
                i.Used = true;
            }

            //Could be 750k in this hit
            await using (var dbc2 = _PublishingDbContextFac())
            {
                var bargs = new SubsetBulkArgs
                {
                    PropertiesToInclude = new[] { nameof(EksCreateJobInputEntity.Used) }
                };
                await dbc2.BulkUpdateAsync2(_Output, bargs); //TX
            }

            _EksEngineResult.OutputCount += _Output.Count;

            _EksResults.Add(new EksInfo {
                TekCount = _Output.Count, TotalSeconds = _BuildEksStopwatch.Elapsed.TotalSeconds
            });
            _Output.Clear();
        }
        private async Task Build()
        {
            var args = _KeyBatch.ToArray();

            var content = await _SetBuilder.BuildAsync(args);

            var e = new EksCreateJobOutputEntity
            {
                Region               = DefaultValues.Region,
                Release              = _Start,
                CreatingJobName      = JobName,
                CreatingJobQualifier = ++_Counter,
                Content              = content,
            };

            _KeyBatch.Clear();

            await WriteOutput(e);
            await WriteUsed(_Used.ToArray());
        }