Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timeout values and optimize loop #1521

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.apache.commons.io.FileUtils;
import org.bson.conversions.Bson;
Expand Down Expand Up @@ -67,7 +68,11 @@ public class JiraIntegrationAction extends UserAction {
private final String CREATE_ISSUE_ENDPOINT = "/rest/api/3/issue";
private final String ATTACH_FILE_ENDPOINT = "/attachments";
private static final LoggerMaker loggerMaker = new LoggerMaker(ApiExecutor.class);
private static final OkHttpClient client = CoreHTTPClient.client.newBuilder().build();
private static final OkHttpClient client = CoreHTTPClient.client.newBuilder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.build();

public String testIntegration() {

Expand Down Expand Up @@ -104,11 +109,15 @@ public String testIntegration() {
for (Object projObj: projects) {
BasicDBObject obj = (BasicDBObject) projObj;
String key = obj.getString("key");
loggerMaker.errorAndAddToDb("evaluating issuetype for project key " + key + " ,actualProjId " + projId, LoggerMaker.LogDb.DASHBOARD);
loggerMaker.infoAndAddToDb("evaluating issuetype for project key " + key + " ,actualProjId " + projId, LoggerMaker.LogDb.DASHBOARD);
if (issueType!=null) {
break;
}

if (!key.equalsIgnoreCase(projId)) {
continue;
}
loggerMaker.errorAndAddToDb("evaluating issuetype for project key " + key + ", project json obj " + obj, LoggerMaker.LogDb.DASHBOARD);
loggerMaker.infoAndAddToDb("evaluating issuetype for project key " + key + ", project json obj " + obj, LoggerMaker.LogDb.DASHBOARD);
BasicDBList issueTypes = (BasicDBList) obj.get("issuetypes");
issueType = determineIssueType(issueTypes, "TASK");
loggerMaker.infoAndAddToDb("evaluated issue type for TASK type " + issueType, LoggerMaker.LogDb.DASHBOARD);
Expand Down
Loading