예제 #1
0
        public async Task StoreSnapshotAsync(SnapshotEnvelope snapshotEnvelope, CancellationToken cancellationToken = default)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var snapshotDescriptor = SerializeSnapshot(snapshotEnvelope.StreamId, snapshotEnvelope.Snapshot, snapshotEnvelope.AggregateVersion);
            await _snapshotRepository.StoreSnapshotAsync(snapshotEnvelope.StreamId, snapshotDescriptor, cancellationToken);

            stopWatch.Stop();
            _logger.LogDebug("SnapshotStore.StoreSnapshotAsync for {Stream} took {ElapsedMilliseconds} ms", snapshotEnvelope.StreamId, stopWatch.ElapsedMilliseconds);
        }