Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Sep 10, 2024
1 parent 13e7527 commit 2b6ecd7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion server/docker/logging.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ io.helidon.common.level=INFO
# Configure specific loggers
#com.hedera.block.server.mediator.LiveStreamMediatorImpl.level=FINE
#com.hedera.block.server.persistence.storage.write.BlockAsDirWriter.level=FINE
com.hedera.block.server.producer.ProducerBlockItemObserver.level=FINE
#com.hedera.block.server.producer.ProducerBlockItemObserver.level=FINE

# Console handler configuration
handlers = java.util.logging.ConsoleHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public void onEvent(
}
}

@Override
public boolean isTimeoutExpired() {
return livenessCalculator.isTimeoutExpired();
}

@NonNull
private ResponseSender getResponseSender(
@NonNull final SubscribeStreamResponse subscribeStreamResponse) {
Expand Down Expand Up @@ -232,9 +237,4 @@ public void send(@NonNull final SubscribeStreamResponse subscribeStreamResponse)
subscribeStreamResponseObserver.onNext(fromPbj(subscribeStreamResponse));
}
}

@Override
public boolean isTimeoutExpired() {
return livenessCalculator.isTimeoutExpired();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class SubscriptionHandlerBase<V> implements SubscriptionHandler<
private final Map<BlockNodeEventHandler<ObjectEvent<V>>, BatchEventProcessor<ObjectEvent<V>>>
subscribers;

private final LongGauge longGauge;
private final LongGauge subscriptionGauge;
protected final RingBuffer<ObjectEvent<V>> ringBuffer;
private final ExecutorService executor;

Expand All @@ -48,11 +48,11 @@ public SubscriptionHandlerBase(
BlockNodeEventHandler<ObjectEvent<V>>,
BatchEventProcessor<ObjectEvent<V>>>
subscribers,
@NonNull final LongGauge longGauge,
@NonNull final LongGauge subscriptionGauge,
final int ringBufferSize) {

this.subscribers = subscribers;
this.longGauge = longGauge;
this.subscriptionGauge = subscriptionGauge;

// Initialize and start the disruptor
final Disruptor<ObjectEvent<V>> disruptor =
Expand All @@ -75,8 +75,10 @@ public void subscribe(@NonNull final BlockNodeEventHandler<ObjectEvent<V>> handl
// Keep track of the subscriber
subscribers.put(handler, batchEventProcessor);

// update the subscriber metrics
longGauge.set(subscribers.size());
// Update the subscriber metrics.
// Subtract 1 to remove the StreamValidator from
// the count.
subscriptionGauge.set(subscribers.size() - 1);
}

@Override
Expand All @@ -96,8 +98,10 @@ public void unsubscribe(@NonNull final BlockNodeEventHandler<ObjectEvent<V>> han
ringBuffer.removeGatingSequence(batchEventProcessor.getSequence());
}

// update the subscriber metrics
longGauge.set(subscribers.size());
// Update the subscriber metrics.
// Subtract 1 to remove the StreamValidator from
// the count.
subscriptionGauge.set(subscribers.size() - 1);
}

@Override
Expand Down

0 comments on commit 2b6ecd7

Please sign in to comment.