@@ -74,6 +74,7 @@ public abstract class NettyStorageDriverBase<I extends Item, O extends Operation
7474 private final Class <SocketChannel > socketChannelCls ;
7575 private final NonBlockingConnPool connPool ;
7676 private final boolean sslFlag ;
77+ private final int responseDuration ;
7778 private final SslContext sslCtx ;
7879 protected final ChannelFutureListener reqSentCallback = this ::sendFullRequestComplete ;
7980
@@ -205,6 +206,7 @@ protected NettyStorageDriverBase(
205206 try (final var logCtx = CloseableThreadContext .put (KEY_STEP_ID , this .stepId ).put (KEY_CLASS_NAME , CLS_NAME )) {
206207 connPool = createConnectionPool ();
207208 }
209+ responseDuration = netConfig .intVal ("response-duration" );
208210 }
209211
210212 protected NonBlockingConnPool createConnectionPool () {
@@ -578,6 +580,13 @@ public void complete(final Channel channel, final O op) {
578580 ThreadContext .put (KEY_STEP_ID , stepId );
579581
580582 try {
583+ if (responseDuration > 0 ) {
584+ try {
585+ long elapsed = (op .START_OFFSET_MICROS + System .nanoTime () / 1000 ) - op .reqTimeStart ();
586+ long sleepMs = responseDuration - (elapsed / 1000 );
587+ if (sleepMs > 0 ) { Thread .sleep (sleepMs ); }
588+ } catch (Exception e ) {}
589+ }
581590 op .finishResponse ();
582591 } catch (final IllegalStateException e ) {
583592 LogUtil .exception (Level .DEBUG , e , "{}: invalid load operation state" , op .toString ());
0 commit comments