clear old function failure exception from stats
### Motivation
Right now, if function fails first time and then starts and runs successfully then still function-stats shows old exception in stats which confuses user regarding function current state.
### Modifications
Hide old exception if function started successfully.
@@ -108,7 +108,7 @@ public class RuntimeSpawner implements AutoCloseable {
return runtime.getFunctionStatus().thenApply(f -> {
FunctionStatus.Builder builder = FunctionStatus.newBuilder();
builder.mergeFrom(f).setNumRestarts(numRestarts).setInstanceId(instanceConfig.getInstanceId());
- if (runtimeDeathException != null) {
+ if (!f.getRunning() && runtimeDeathException != null) {
builder.setFailureException(runtimeDeathException.getMessage());
}
return builder.build();
