Skip to content

Commit

Permalink
fix: is Running state check
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Mar 19, 2024
1 parent a1d7538 commit 0758919
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public class DatabendClientV1
firstNonNull(DatabendClientV1.class.getPackage().getImplementationVersion(), "jvm-unknown");
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
public static final JsonCodec<QueryResults> QUERY_RESULTS_CODEC = jsonCodec(QueryResults.class);
public static final String succeededState = "succeeded";
public static final String failedState = "failed";
public static final String finishedState = "finished";


public static final String QUERY_PATH = "/v1/query";
private static final long MAX_MATERIALIZED_JSON_RESPONSE_SIZE = 128 * 1024;
Expand Down Expand Up @@ -214,15 +218,15 @@ public boolean isRunning() {
return false;
}
// if State is Failed or Finished, then it is not running
if (results.getState().toLowerCase(Locale.US).equals("failed") || results.getState().toLowerCase(Locale.US).equals("finished")) {
if (results.getState().toLowerCase(Locale.US).equals(succeededState) || results.getState().toLowerCase(Locale.US).equals(failedState) || results.getState().toLowerCase(Locale.US).equals(finishedState)) {
return false;
}
// is running if nextUri is not null
return results.getNextUri() != null;
}

@Override
public Map<String, String> getAdditionalHeaders() {
public Map<String, String> getAdditionalHeaders() {
return additonalHeaders;
}

Expand Down

0 comments on commit 0758919

Please sign in to comment.