Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scripted fields taking longer randomly

Jordan Hauser
Contributor
December 10, 2021

Hi all,

So I've been working on a project to pull data from a database and display in on several fields based on the part number picked in each line item.

I got everything running, but it was slow. So I pulled everything down again and I've been adding the fields back in piecemeal and seeing which ones are going slow, and editing the code until I figure out how to reduce it.

Something I've seen happening randomly is that in a set of 10 fields configured exactly the same, I refresh the page in my testing project and one of the fields will read off ~3000ms while the other ones display ~15-20ms.

Has anyone else experienced this? I'm using scriptrunner for the scripted fields, the main part number picker fields are the 'database picker' fields while all the rest are custom scripted fields for other sql queries based on the part number and calculation fields. Just trying to figure out why identical configs are running different

-Jordan



Edit: Additional info, I'm looking at the 'all issues' list, refreshing the page and seeing this happen. If I just click between issues there is no loading delay

1 answer

1 accepted

0 votes
Answer accepted
Brant Schroeder
Community Champion
April 11, 2022

@Jordan Hauser Have you tried increasing the number of DB connections?  Sounds like you might just be running out of threads.

Jordan Hauser
Contributor
April 12, 2022

Sorry I never closed this, I found what I was doing was bad practice. Querying the db 100+ times individually was yielding these odd results I detailed in this post.

Instead of making all of these individual database picker fields and having the configuration script return the proper values for the important field selected, now I just do it all in listeners once the important field has a selection.

Basically when someone picks a part number, there is some additional info I was trying to pull from the database, but multiplied by 10 since there were 10 line items. Now with a listener I just check the part number field, run the queries in as few db connections as possible, then update the fields with the new values and I'm seeing significantly better results.

Suggest an answer

Log in or Sign up to answer