YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.22k stars 403 forks source link

Randomize firstCheckTime into the future, rather than scheduling in the past #481

Open esoderquist opened 2 years ago

esoderquist commented 2 years ago

Presently a random offset is subtracted from time() and scheduled (such that the event is scheduled in the past, causing the job to execute on each WP-Cron execution since the scheduled time has passed). PR changes this to schedule the next update cycle at a randomized time in the future.

YahnisElsts commented 2 years ago

If I remember correctly, the intent of using a past timestamp was to ensure that the first update check would happen as soon as possible, and all future checks would happen with a randomized offset. See #323 for some relevant discussion.

By using a positive offset, we would lose that first, immediate check.