Are Google Apps Scripting making a comeback?

"Reentrant" may not be the correct term, but I think it's close.

If I share a script with another user and we both execute it at the same time, do we overwrite all the other variables? or are these two executions running in completely different memory spaces?

Where can I read about this?

If re-entrant is the wrong term, which is the right one?

Update 10/14/03 o9: 45 EDT: I don't think this warrants a new question.

I understand from Serge and Enrique that individual executions are "thread safe" and that shared resource operations require protection, presumably with "Lock Service" .

I am trying to figure out how to rationalize my current ad hoc "strategy". I have a web application that uses a spreadsheet to keep track of a lot of settings, including querying another large table for shortlisted data. I have shared copies with another user and then with another. Now I have a mess of spreadsheets and script copies to keep track of. (This is how he grew up - don't ask.) I don't want to lose my local cache tables, but I want to avoid unnecessarily sharing multiple copies of a thread safe script.

I'm considering a centralized lookup table that links a local cache spreadsheet to a given user, but it really looks like I have to rewrite the whole thing with BigQuery or some more serious storage like that. It looks like more effort than value.

Any suggestion would be appreciated.

Update 14/10/03 12:15 PM EDT:

The WebApp was originally contained in a spreadsheet, but I moved it so they are shared. Add to the craziness. I now have a script that uses DriveApp to create directories, share with the user, copy in a spreadsheet and script, and a few other things. Actually, for the sake of security, besides WebAppScript, I have a WebAppScriptProxy that publishes the public WebAppScript functions. This is what the user interacts with.

+3


source to share


3 answers


In completely different memory spaces.

I don't think " reentrant " is the most accurate term here, as there is no interruption of one code to run another. They all happen simultaneously and safely. I'm not really sure which term is correct. I think you could say that the whole environment is "thread safe" as they run on different threads / processes and no variables are shared.

You only need to take care of shared resources like general table or document property etc.



- change

, . , script URL- ( script). , BigQuery, BigQuery. , . , - Google , - concurrency - .

At the bottom, share with your users only what you need and save the rest. It's easier for them and for you just like that. For example, if they don't need to manually edit the local cache spreadsheet, then share it with them. Again, if all they need is a link to access your web application, then don't make it any more complicated.

+3


source


Not only you and the other user, but you and yourself between two different function calls (for example, but not only) 2 browser windows ...

This is why you cannot use a global variable in the normal way in Google Apps Script: every time you execute any function, the entire global variable is reinitialized and they are only available within that function call (and any function call from within that function ...



Keep in mind that this only applies to Script variables and obviously to documents or other persistent storage locations (like properties) where concurrent execution is likely to create concurrency problems by overwriting each other.

+3


source


I tend to think that scripts are closer to old old CGI scripts written in Perl, Python, Bash, whatever. Only this time it's written in JavaScript.

Every time you click on the server, the web server starts a new version of the script from scratch.

This is a bit weird because it has a great framework that it uses to carry information back and forth. But that's pretty much it.

0


source







All Articles