Skip to content

Commit

Permalink
Complete python gRPC requests when closing
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet committed Nov 6, 2023
1 parent eec9581 commit d7f39f6
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,12 @@ public void onCompleted() {
}
};
}

@Override
public synchronized void close() throws Exception {
if (request != null) {
request.onCompleted();
}
super.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,12 @@ public void onCompleted() {
}
};
}

@Override
public synchronized void close() throws Exception {
if (request != null) {
request.onCompleted();
}
super.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ public void start() throws Exception {

@Override
public synchronized void close() throws Exception {
if (server != null) server.close(false);
if (server != null) {
server.close(false);
}
}

@Override
protected synchronized void stop() throws Exception {
if (server != null) server.close(true);
if (server != null) {
server.close(true);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ public void start() throws Exception {

@Override
public synchronized void close() throws Exception {
if (server != null) server.close(false);
if (server != null) {
server.close(false);
}
super.close();
}

@Override
protected synchronized void stop() throws Exception {
if (server != null) server.close(true);
if (server != null) {
server.close(true);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ public void start() throws Exception {

@Override
public synchronized void close() throws Exception {
if (server != null) server.close(false);
if (server != null) {
server.close(false);
}
super.close();
}

@Override
protected synchronized void stop() throws Exception {
if (server != null) server.close(true);
if (server != null) {
server.close(true);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ public void onNext(SinkRequest request) {
public void onError(Throwable throwable) {}

@Override
public void onCompleted() {}
public void onCompleted() {
responseObserver.onCompleted();
}
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ public void onNext(SourceRequest request) {
public void onError(Throwable throwable) {}

@Override
public void onCompleted() {}
public void onCompleted() {
responseObserver.onCompleted();
}
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ default void close() throws Exception {}
/**
* Gracefully restart the agent.
*
* @throws Exception
* @throws Exception if an error occurs
*/
default void restart() throws Exception {
log.info("Restart is not supported for agent type {}", agentType());
Expand Down

0 comments on commit d7f39f6

Please sign in to comment.