Concurrent queries ( Optimistic with API)

Hi Retool team,
Please help me check that case.

When I tried to make 2 concurrent CSV file upload requests from Retool, it seemed like 1 request was deferred and waited until after the other request was done before it started calling.
My queries is GRPC.
Is there anyway to prevent other API call ( i want only 1 API run at the time) or make them no wait for other ?

I think Retool have query queue. :frowning:
So how to make Retool don't put query into queue.

Hello @Tan_Tran :wave:,

If you want to have one query call another query on success, you can try chaining queries.

If you want to create your own function that awaits the response of two promises, check out this forum post for ideas on how to setup your own async function :slight_smile:.

Hi @AbbeyHernandez ,
Yes, its good. Can you give me solution in case 2 query was called by 2 user(2 browser, 2 computer,...)
Thank you.!

Thanks for clarifying your question a bit more! Generally, queries from two different users on two computers will not have an impact on each other.

Can you share more on why you thought this was happening?

@AbbeyHernandez
My team have 2 screen.

  • Upload CSV screen
  • Upload docx screen.
    When we upload CSV, we want to prevent other user upload docx file. (Cause the filename in CSV will be update to DB, its very risk if docx file have same name).

Hmm :thinking:, sounds like you're running into a Race Condition :bulb:.

Here are some ideas that may work for you:

  • Query the database before making an update.
  • Utilize constraints to the column in your DB.
  • Is it possible to add constraints in the API?
  • If the name of the file can be changed, another option may be to hash the file name or add a hash to the end of file name to make it unique.

Hope that helps move you along! :slight_smile: