File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
src/main/java/io/digdag/plugin/slack Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 1313import okhttp3 .Call ;
1414import okhttp3 .FormBody ;
1515import okhttp3 .Interceptor ;
16- import okhttp3 .MediaType ;
1716import okhttp3 .OkHttpClient ;
1817import okhttp3 .Request ;
1918import okhttp3 .RequestBody ;
2019import okhttp3 .Response ;
21- import okhttp3 .ResponseBody ;
2220
2321import java .io .IOException ;
2422import java .util .Arrays ;
25- import java .util .logging .Logger ;
2623
2724import static java .nio .charset .StandardCharsets .UTF_8 ;
2825
@@ -123,13 +120,10 @@ static class RetryInterceptor implements Interceptor
123120 public Response intercept (Chain chain ) throws IOException
124121 {
125122 Request request = chain .request ();
126- // Response response = chain.proceed(request);
127- Response response = new Response .Builder ().code (503 ).message ("503 Service Unavailable" ).body (ResponseBody .create (MediaType .parse ("application/json; charset=utf-8" ), "{}" )).protocol (okhttp3 .Protocol .HTTP_1_1 ).request (request ).build ();
123+ Response response = chain .proceed (request );
128124 int retryCount = 0 ;
129- Logger logger = Logger .getLogger (RetryInterceptor .class .getName ());
130125 while (!response .isSuccessful () && retryCount < MAX_RETRY_COUNT && Arrays .asList (retryHttpStatus ).contains (response .code ())) {
131126 retryCount ++;
132- logger .info ("Retry count: " + retryCount );
133127
134128 response .close ();
135129 try {
@@ -138,8 +132,7 @@ public Response intercept(Chain chain) throws IOException
138132 e .printStackTrace ();
139133 }
140134 // retry request
141- // response = chain.proceed(request);
142- response = new Response .Builder ().code (503 ).message ("503 Service Unavailable" ).body (ResponseBody .create (MediaType .parse ("application/json; charset=utf-8" ), "{}" )).protocol (okhttp3 .Protocol .HTTP_1_1 ).request (request ).build ();
135+ response = chain .proceed (request );
143136 }
144137 return response ;
145138 }
You can’t perform that action at this time.
0 commit comments