Is there a workaround for 2 min delayed response if Google Sheet was just edited?

时间:2018-03-25 20:02:55

标签: google-apps-script google-sheets

I'm seeing delayed responses of several minutes if my Google Apps web app attempts to read data from a spreadsheet that was changed moments before the request.

I'd like to know if this is normal and expected or whether I am doing something wrong.

My GAS script is a standalone project, not bound to a specific sheet.

If I were to attach an onEdit() handler to the sheet itself, (which read from the affected area, for example), would it wake up the caching system, (or whatever there is intervening between the sheet and my script), and set it up for a more rapid response?

Update: I experience the delay when running the script in dev mode. The published script called from a web page throws an Error 500 (Internal server error.)

Update: To explain the steps in more detail. In the GAS editor I have a getSingleRow() method, a testGetSingleRow() method and a doGet() method. The latter two both call the former in exactly the same way:

  1. If I use the GAS editor to call testGetSingleRow() locally, I get the data back in about 1.5 seconds.

  2. If I use my web page to call doGet() remotely, I get the data back in about 5 seconds.

  3. If I edit the single row, and then immediately use the GAS editor to call testGetSingleRow() locally, there is a delay of almost exactly two minutes!

  4. If I edit a different row, and then immediately use my web page to call doGet() remotely, I get Error 500 back after about 30 seconds.

Update: I have decided that the sheet was probably corrupted internally. Closing question.

0 个答案:

没有答案
相关问题