Show List of Inventory and Handle Error Timeout

I am trying to display all inventories but the timeout error keeps showing.

Here is a snippet of the code, and I am running this via groovy script runner 

try

{

    int TENSECONDS = 10*1000
    int THIRTYSECONDS =30*1000
    HttpClient httpClient = HttpClientBuilder.create().build()
    HTTPBuilder builder = new HTTPBuilder()

     builder.getClient().getParams().setParameter("http.connection.timeout", new Integer(THIRTYSECONDS))
    builder.getClient().getParams().setParameter("http.socket.timeout", new Integer(THIRTYSECONDS))

    HttpGet request = new HttpGet(addr)
    request.setHeader("Authorization", "Basic ${authString}")
    request.addHeader("content-type", "application/json")
   

    response = httpClient.execute(request)
    return response

 

}

If i test and see at what part it runs, if I put a return request, then it works.

I believe the error comes from "response = httpClient.execute(request)" it just doesnt work. And after it runs, it shows "Error timeout, no stack trace available"

Any help? and also some sites where I can get tutorials?

 

 

1 answer

0 vote

Just write to the logs and ignore the result on the screen. The UI has a hard-coded timeout of 90s or something. Until long-running tasks get into the plugin this is not going to change.

But does the system you are talking to really take that long to respond?

 

I need help regarding how to show the inventories too. its stops working when it goes to this line : response = httpClient.execute(request) Do I still have to include the code for timeout? Because my only problem right now is being able to return the values from And as far as I know the system wont take that long to respond, so Im guessing the problem is within the code? response = httpClient.execute(request) return response

I'd look at using HttpBuilder, it's a wrapper round the library you are using. Get it working first with curl/wget.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

49 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you