tapestry-cloud / tapestry

PHP static site generator using the plates template system
https://www.tapestry.cloud/
MIT License
32 stars 1 forks source link

Temporary file locking when Tapestry ran concurrently #157

Closed carbontwelve closed 6 years ago

carbontwelve commented 7 years ago

Within the gulp build system Tapestry can end up being invoked multiple times at once resulting in file permission errors - or at least that looks like what is happening.

Not entirely sure how to test for this, or fix it beyond ensuring Tapestry only runs once per build directory by using a .lock file or something of the sort?

carbontwelve commented 7 years ago

This issue comes up when Tapestry is attempting to write to a directory that browser sync is trying to read from.

Tapestry should check to see if a file is locked for writing before attempting to write and if the file is found to be locked it should wait a certain number of attempts before failing.

If possible during the writing process if an item in the collection is found to be locked, it could be moved to the end of the stack; this way by the time the rest of the unlocked items are processed the item that was locked should be released.

carbontwelve commented 7 years ago

Tapestry should only really once once at a time, maybe implement some form of process lock file so it knows if it has been run concurrently and exit.

carbontwelve commented 6 years ago

Implemented by #274