Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,891
Community Members
 
Community Events
165
Community Groups

Scriptrunner REST endpoint Response flag not shown in UI after certain amount of time

Hi,

I am currently stuck with a problem regarding the ScriptRunner REST endpoint Response.
I have a script that if finished correctly should send a notification response to the user.
This works as expected, if the time required for the script to run is about 5 seconds.

Due to some reasons the script can take up to several minutes to run.
If it does, then the UI does not show the Response of the Script REST endpoint.

The Response is defined like the following:

def flag = [
type : 'success',
title: "S3 REST endpoint",
close: 'manual',
body : "Test"
]

Response.ok(JsonOutput.toJson(flag)).build()

To analyse the problem with the script running longer I checked the logs by putting 

log.warn(flag)

before the Response.  It shows the flag correctly but the response is not visible in the UI.

Is there some sort of Jira limitation I am not aware of?

Best regards
Fabian

 

1 answer

1 accepted

1 vote
Answer accepted

Flags are not well suited for long-running tasks. Your browser will give up before you get a response default browser timeout).

Ideally, some sort of UI that provides a progress bar would be best. But that' not something that's available from scriptrunner.

What you might do is send the processing of your long-running task into a separate thread and return a flag that says "task is started". And perhaps provide some other ways to alert the users when it is finished (maybe via email notification).

Thank you for the detailed explanation.
I will try to use a combination of issue properties and separate threads.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Improving the Create Issue Experience in Jira Service Management Cloud

Hello everyone!  We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen.  We have just starte...

218 views 7 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you