- // We update the feed last update started date before anything else.
- // There is no lag due to feed contents downloads
- // It prevent an other process to update the same feed.
-
- if(count($feeds_to_update) > 0) {
- $feeds_quoted = array();
-
- foreach ($feeds_to_update as $feed) {
- array_push($feeds_quoted, "'" . db_escape_string($feed) . "'");
- }
+ // Update last_update_started before actually starting the batch
+ // in order to minimize collision risk for parallel daemon tasks
+ if (count($feeds_to_update) > 0) {
+ $feeds_quoted = array_map(function ($s) { return "'" . db_escape_string($s) . "'"; }, $feeds_to_update);