improved http check status mechanism
This commit is contained in:
parent
49c8ea0db9
commit
0a459e4b48
1 changed files with 42 additions and 41 deletions
|
|
@ -504,7 +504,7 @@ public class KSeFAuthManager {
|
||||||
|
|
||||||
// Now we need to wait until auth/{AuthRef} will return 200
|
// Now we need to wait until auth/{AuthRef} will return 200
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
long timeout = 120_000; // 120 Sekunden
|
long timeout = 180_000; // 180 Sekunden
|
||||||
|
|
||||||
while (System.currentTimeMillis() - start < timeout) {
|
while (System.currentTimeMillis() - start < timeout) {
|
||||||
int status = this.checkSessionStatus(workitem);
|
int status = this.checkSessionStatus(workitem);
|
||||||
|
|
@ -529,7 +529,7 @@ public class KSeFAuthManager {
|
||||||
// Optional: prüfen, ob Timeout erreicht wurde
|
// Optional: prüfen, ob Timeout erreicht wurde
|
||||||
if (System.currentTimeMillis() - start >= timeout) {
|
if (System.currentTimeMillis() - start >= timeout) {
|
||||||
throw new PluginException(KSeFAuthManager.class.getSimpleName(), ERROR_API,
|
throw new PluginException(KSeFAuthManager.class.getSimpleName(), ERROR_API,
|
||||||
"API Error - failed to init new interactive session - ⚠️ Timeout reached after 120 seconds!");
|
"API Error - failed to init new interactive session - ⚠️ Timeout reached after 180 seconds!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -889,9 +889,10 @@ public class KSeFAuthManager {
|
||||||
|
|
||||||
httpResponse = response.statusCode();
|
httpResponse = response.statusCode();
|
||||||
logger.info("│ ├── HTTP Response: " + httpResponse);
|
logger.info("│ ├── HTTP Response: " + httpResponse);
|
||||||
|
|
||||||
logger.info("│ ├── " + response.body());
|
logger.info("│ ├── " + response.body());
|
||||||
|
|
||||||
|
if (httpResponse >= 200 && httpResponse <= 299) {
|
||||||
|
|
||||||
try (Jsonb jsonb = JsonbBuilder.create()) {
|
try (Jsonb jsonb = JsonbBuilder.create()) {
|
||||||
JsonObject jsonObject = jsonb.fromJson(response.body(), JsonObject.class);
|
JsonObject jsonObject = jsonb.fromJson(response.body(), JsonObject.class);
|
||||||
|
|
||||||
|
|
@ -935,7 +936,7 @@ public class KSeFAuthManager {
|
||||||
throw new PluginException(KSeFAuthManager.class.getSimpleName(), ERROR_API,
|
throw new PluginException(KSeFAuthManager.class.getSimpleName(), ERROR_API,
|
||||||
"Error parsing JSON response: " + e.getMessage());
|
"Error parsing JSON response: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue