getgrav / grav-plugin-comments

Grav Comments Plugin
http://getgrav.org
56 stars 28 forks source link

Avoid concurrent file access by using file locking? #92

Open NicoHood opened 4 years ago

NicoHood commented 4 years ago

I am wondering if it would make sense to add some basic file locking to the comments plugin? If two users would comment at the same time on the same site (which could happen, if the page is popular), the comment file would be corrupted.

Is this assumption correct or does grav have some other locking in the backend (like only processing one form at the same time)?

I've use this API then: https://learn.getgrav.org/16/api#class-gravframeworkfileabstractfile

It provides basic locking. However some method to wait for the lock to release is not implemented. Is this something that could make sense in the general API?