Closed ElasticCoder closed 11 months ago
The CancellationToken can be passed to Task.Run in the InMemoryStorageEngine. Note the last parameter added to the code below.
return Task.Run(() => { if (!streams.ContainsKey(streamId)) { streams[streamId] = new List<StorageEvent>(); } var firstEvent = events.First(); if (firstEvent.EventNumber - 1 != streams[streamId]. { throw new ConcurrencyException($"Concurrency conflict when appending to stream {streamId}. Expected revision {firstEvent.EventNumber - 1} : Actual revision {streams[streamId].Count}"); } cancellationToken.ThrowIfCancellationRequested(); streams[streamId].AddRange(events); AddEventsToAllStream(events); }, cancellationToken);
The CancellationToken can be passed to Task.Run in the InMemoryStorageEngine. Note the last parameter added to the code below.