A weirdly slow procedure

I have a procedure that is strangely slow, like 48 seconds recently to close 15 databases. The procedure will save and close all the open databases and then quit. Just to make sure all the databases were saved before quitting.

Here is the code:

let lvDBs=arrayreverse(info("files"),cr())
looparray lvDBs,cr(),theDB
    setactivedatabase theDB
    saveandclose ""
endloop
quit

Any ideas about why this takes so long?

If you read the documentation for saveandclose, you’ll see that there is a delay before the database closes to allow the save to complete. The default delay is 3 seconds, so 3*15 is 45 seconds - exactly the results you are getting.

This should be unnecessary. Panorama will automatically save all modified databases when you quit. The exception would be if you have made changes that aren’t undo-able, for example in a procedure. But in that case I would suggest that you probably want to save immediately after making the change, rather than waiting until you quit.

Thanks. I had lost track of when saving was necessary.