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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,552,838
Community Members
 
Community Events
184
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
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 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).

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
AUG Leaders

Atlassian Community Events