Skip to content

Commit

Permalink
Remove Debug Output from EventsourceRunnable
Browse files Browse the repository at this point in the history
  • Loading branch information
cdr-chakotay committed Sep 2, 2024
1 parent 24490d9 commit 76ac9af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/com/transloadit/sdk/EventsourceRunnable.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ protected void handleMessageEvent(MessageEvent messageEvent) {
String eventName = messageEvent.getEventName();
String data = messageEvent.getData();

System.out.println("Event: " + eventName + "\t" + "Data: " + data);
// Check if the event is a message event without
if (eventName.equals("message")) {
switch (data) {
Expand All @@ -130,7 +129,8 @@ protected void handleMessageEvent(MessageEvent messageEvent) {
assemblyListener.onAssemblyUploadFinished();
break;
default:
System.out.printf("Unknown message: %s\n", data);
LocalOperationException e = new LocalOperationException("Unknown SSE message: " + data);
assemblyListener.onError(e);
}
} else {
switch (eventName) {
Expand All @@ -156,12 +156,14 @@ protected void handleMessageEvent(MessageEvent messageEvent) {
case "assembly_execution_progress":
JSONObject executionProgress = new JSONObject(data);
double overallProgress;
// Address the case where the progress_combined key is not present in the JSON object
try {
overallProgress = executionProgress.getDouble("progress_combined");
} catch (Exception e) {
overallProgress = 0;
}

// Address the case where the progress_per_original_file key is not present in the JSON object
JSONObject progressPerOriginalFile;
try {
progressPerOriginalFile = executionProgress.getJSONObject("progress_per_original_file");
Expand All @@ -172,7 +174,8 @@ protected void handleMessageEvent(MessageEvent messageEvent) {
assemblyListener.onAssemblyProgress(overallProgress, progressPerOriginalFile);
break;
default:
System.out.printf("Unknown message: %s\n", eventName);
LocalOperationException e = new LocalOperationException("Unknown SSE message: " + data);
assemblyListener.onError(e);
}
}

Expand Down

0 comments on commit 76ac9af

Please sign in to comment.