@@ -100,16 +100,17 @@ public boolean pollAndHandleResults(String jobId, SyncOutput syncOutput)
100
100
} catch (JobServiceUnavailableException e ) {
101
101
// This error is expected to be encountered if we timed out waiting for
102
102
// the job to complete, but the job is still in a transient state.
103
- // We return a 503 response to the client with a retry-after header .
104
- log .warn ("Job " + jobId + " still processing, returning 503 response " );
103
+ // We return a VOTable error response with HTTP 200 (traditional DAL approach) .
104
+ log .warn ("Job " + jobId + " still processing, returning VOTable error with 200 status " );
105
105
try {
106
- syncOutput .setCode (503 );
107
- syncOutput .setHeader ("Content-Type" , "text/plain" );
108
- syncOutput .setHeader ("Retry-After" , String .valueOf (e .getRetryAfterMs () / 1000 ));
109
- String message = e .getMessage ();
106
+ syncOutput .setCode (200 );
107
+ syncOutput .setHeader ("Content-Type" , "application/x-votable+xml" );
108
+ //syncOutput.setHeader("Retry-After", String.valueOf(e.getRetryAfterMs() / 1000));
109
+ String message = VOTableUtil .generateErrorVOTable (
110
+ "Query timeout exceeded for synchronous execution. Please use /async endpoint for long-running queries." );
110
111
syncOutput .getOutputStream ().write (message .getBytes ());
111
112
} catch (IOException ioe ) {
112
- log .error ("Failed to write service unavailable message to output stream" , ioe );
113
+ log .error ("Failed to write timeout error message to output stream" , ioe );
113
114
}
114
115
return false ;
115
116
}
@@ -404,4 +405,4 @@ private void handleError(SyncOutput syncOutput, int statusCode, String errorMess
404
405
log .error ("Failed to write error message to output stream" , e );
405
406
}
406
407
}
407
- }
408
+ }
0 commit comments