예제 #1
0
        public void Should_set_send_signal_when_overflow_occurs_while_some_data_is_in_buffers()
        {
            pool.TryAcquire(out _).Returns(false);

            stats.EstimateStoredSize().Returns(1L);

            sink.Put(Stream, _ => {});

            state.SendSignal.WaitAsync().IsCompleted.Should().BeTrue();
        }
예제 #2
0
        public RecordWriteResult TryWrite(IBuffer buffer, Action <IHerculesEventBuilder> build, out int recordSize)
        {
            var storedSizeBefore = statistics.EstimateStoredSize();

            var result = baseWriter.TryWrite(buffer, build, out recordSize);

            var storedSizeAfter = statistics.EstimateStoredSize();

            if (storedSizeAfter >= constantSignalThreshold ||
                storedSizeAfter > 0 && result == RecordWriteResult.OutOfMemory ||
                storedSizeBefore < transitionSignalThreshold && storedSizeAfter >= transitionSignalThreshold)
            {
                signal.Set();
            }

            return(result);
        }
 private void SetupStoredSizes(long before, long after)
 => statistics.EstimateStoredSize().Returns(before, after);