YahnisElsts / wp-update-server

A custom update API for WordPress plugins and themes. Intended to be used in conjunction with my plugin-update-checker library.
MIT License
824 stars 176 forks source link

Delete a cache file if it's expired #22

Closed jrfnl closed 9 years ago

YahnisElsts commented 9 years ago

There's a race condition:

  1. A notices that a cache file is expired.
  2. B updates the cache, overwriting the file.
  3. A deletes the new file.

It's possible to prevent the race, but that's probably not necessary in this simple case. I'd recommend just adding a comment that there's a race condition in that method.

jrfnl commented 9 years ago

I agree, after all, in that case A would just recreate the new file after that. Obviously we don;t want C to come along in the microsecond that takes, but chances are small.

Added the comment as per your suggestion.