X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FUpdateContacts.php;h=6fb71eec383fff892fea758f28e99343589372c4;hb=1234d5b77a6d163732eb64b475dbe133fb0efb9e;hp=31426e79f22245c9ef65210f5d4a49b1d3d29e6b;hpb=1e4e7d5b5851fd74b7ca1685431764b49e9be361;p=friendica.git diff --git a/src/Worker/UpdateContacts.php b/src/Worker/UpdateContacts.php index 31426e79f2..6fb71eec38 100644 --- a/src/Worker/UpdateContacts.php +++ b/src/Worker/UpdateContacts.php @@ -1,6 +1,6 @@ ['next-update'], 'limit' => $limit]); + $contacts = DBA::select('contact', ['id', 'url', 'gsid', 'baseurl'], $condition, ['order' => ['next-update'], 'limit' => $limit]); $count = 0; while ($contact = DBA::fetch($contacts)) { - if (Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "UpdateContact", $contact['id'])) { - ++$count; + if (Contact::isLocal($contact['url'])) { + continue; } + + try { + if ((!empty($contact['gsid']) || !empty($contact['baseurl'])) && GServer::reachable($contact)) { + $stamp = (float)microtime(true); + $success = Contact::updateFromProbe($contact['id']); + Logger::debug('Direct update', ['id' => $contact['id'], 'count' => $count, 'duration' => round((float)microtime(true) - $stamp, 3), 'success' => $success]); + ++$count; + } elseif (UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id'])) { + Logger::debug('Update by worker', ['id' => $contact['id'], 'count' => $count]); + ++$count; + } + } catch (\InvalidArgumentException $e) { + Logger::notice($e->getMessage(), ['contact' => $contact]); + } + + Worker::coolDown(); } DBA::close($contacts);