Hi again,
Is there any way to speed up the get information calls to the shelf?
I noticed the task was taking a very long time, and it seems that the âawaitâ calls to the shelf can take between 20 and 60 seconds to complete. They seem to take longer if the variable on the shelf has been interacted with just before the call (e.g., through a set⌠function), or if a variable value is fetched, edited, and then re-uploaded.
I need this functionality because at some point the code needs to fetch a list of participants, and then pair up participants if there is an even number of them, and then reupload the information about pairs.
The following code, where a dictionary value is fetched, edited and re-uploaded, takes 10-15 seconds.
startTime1 = globalClock.getTime()
participants= await psychoJS.shelf.getDictionaryFieldValue({key: ["General"], fieldName:'participants'})
participants=['blah']
psychoJS.shelf.setDictionaryFieldValue({key: ["General"], fieldName: 'participants', fieldValue : participants})
Diff1=(globalClock.getTime()-startTime1)
text2=Diff1.toString()
However, the code below, which occurs immediately after the previous code, takes around 25-35 seconds. Here there should be less happening (the information is fetched but not re-uploaded), and yet, perhaps because it has just been edited, this code takes much longer.
startTime1 = globalClock.getTime()
participants= await psychoJS.shelf.getDictionaryFieldValue({key: ["General"], fieldName:'participants'})
Diff1=(globalClock.getTime()-startTime1)
text3=Diff1.toString()
If say 10 participants come online and engage with the task at a similar time (to form 5 pairs), the shelf will have to manage requests from 10 people and each request may get even slower.
Many thanks for your help!
James