I have a script that makes a rest api call to another application.
The script then waits for the call to finish.
Meaning the script executes the call then sleeps for 5 seconds then asks if it finished and keeps waiting 5 seconds until it does.
Sometimes the whole execution of the script can take more than 1 hour.
Jira is under a NGINX and this proxy closes the connection after a time out. When this happens the script keeps executing but the console finishes and doesn't come up with results.
Is there a way for the script to keep the connection open while waiting?
Oversimplified example:
while(OtherRestCallIsNotFinished)
{ sleep(1000) keepConnectionOpenWithProxy() }
What about storing the results into a separate file?
Or simply logging them and retrieving this way.
I already do that, but I do not know when the whole script is finished, so I can go to the file and check it.
It would be much better to keep the connection open until it does.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guess you can add a piece of code that will notify you via email after it's done :)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.mail.Email
import com.atlassian.mail.queue.SingleMailQueueItem
def email = new Email("someuser@example.com")
email.setSubject("all done")
email.setBody("")
email.setMimeType("text/html") // for messages with an html body
SingleMailQueueItem item = new SingleMailQueueItem(email)
ComponentAccessor.mailQueue.addItem(item)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The email alternative is a good idea, I have actually just implemented it.
A way to know when the script finished in case the console closed the connection.
I got a response from Adaptavist (ScriptRunner) about this issue.
https://productsupport.adaptavist.com/browse/SRPLAT-3
Basically it is an open request to have a progress response on the script.
In the meantime an email sounds like a good idea to get notified when it finishes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.