Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Fabian Duft September 20, 2021

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

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Peter-Dave Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2021

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).

Fabian Duft September 22, 2021

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

TAGS
AUG Leaders

Atlassian Community Events