int updatePublisherPositionAndLimit()
    {
        int workCount = 0;

        if (State.ACTIVE == state)
        {
            final long producerPosition = producerPosition();
            publisherPos.setOrdered(producerPosition);

            if (subscriberPositions.length > 0)
            {
                long minSubscriberPosition = Long.MAX_VALUE;
                long maxSubscriberPosition = consumerPosition;

                for (final ReadablePosition subscriberPosition : subscriberPositions)
                {
                    final long position = subscriberPosition.getVolatile();
                    minSubscriberPosition = Math.min(minSubscriberPosition, position);
                    maxSubscriberPosition = Math.max(maxSubscriberPosition, position);
                }

                if (maxSubscriberPosition > consumerPosition)
                {
                    consumerPosition = maxSubscriberPosition;
                }

                final long proposedLimit = minSubscriberPosition + termWindowLength;
                if (proposedLimit > tripLimit)
                {
                    cleanBufferTo(minSubscriberPosition);
                    publisherLimit.setOrdered(proposedLimit);
                    tripLimit = proposedLimit + tripGain;
                    workCount = 1;
                }
            }
            else if (publisherLimit.get() > consumerPosition)
            {
                tripLimit = consumerPosition;
                publisherLimit.setOrdered(consumerPosition);
                cleanBufferTo(consumerPosition);
            }
        }

        return workCount;
    }
@Test
    void shouldKeepPublisherLimitZeroOnNoSubscriptionUpdate()
    {
        ipcPublication.updatePublisherPositionAndLimit();
        assertThat(publisherLimit.get(), is(0L));
    }