SDK: photo:saveMetadata() returns before saving metadata to disk
In LR 15.0.1, photo:saveMetadata() often returns before the metadata is actually saved to disk. In LR 14.5.1 and earlier, it blocked until the metadata was saved to disk.
This causes significant problems for plugins that use Exiftool to update photo metadata, especially plugins that change capture date/time, e.g. Capture Time To Exif and Any Filter. (Notoriously, the SDK has never provided a method for plugins to change capture date/time.)
The script in the recipe below demonstrates the problem by saving the metadata to disk for a batch of photos, running Exiftool to change the rating of those photos, then reading the metadata from disk. In LR 14.5.1, it completes correctly. But in LR 15.0.1, the save to disk often completes after Exiftool executes, overwriting Exiftool's change to the rating.
To reproduce with LR 15.0.1 and 14.5.1 on Mac OS 15.7.1:
1. Install Exiftool if not already installed.
2. Download and unzip this catalog:
3. Place a copy of "async-save-bug.lua" in the Lightroom Scripts folder. If Exiftool is somewhere other than the default location /usr/local/bin/exiftool, edit "async-save-bug.lua" to use the correct path.
4. Open the catalog in LR 14.5.1. Observe there are two smart collections, 1 Star and 2 Star, and that all 100 photos are in 1 Star.

5. Select all the photos and do Scripts > async-save-bug. Observe that all 100 photos are now in 2 Star (correct).

6. Exit LR 14.5.1, delete the catalog folder, and unzip a fresh copy from the downloaded .zip.
7. Open the fresh copy in LR 15.0.1 (upgrading the catalog). Observe that all 100 photos are in 1 Star.
8. Select all the photos and do Scripts > async-save-bug. Observe that most of the photos are in 1 Star (incorrect) and only some are in 2 Star (correct), e.g.

9. Repeat steps 6 - 8 and observe differing numbers of photos in 1 Star, a sure sign of a race condition.
