1
1
Fork 0

Cleaned code

This commit is contained in:
Michael 2020-12-02 08:36:23 +00:00
parent 6c3b1ac4bd
commit c1d1b189f7
2 changed files with 3 additions and 12 deletions

View file

@ -91,10 +91,8 @@ class Delayed
Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]);
// It should always contain an URI since this is needed to create a delayed post entry
if (!empty($item['uri']) && self::exists($item['uri'], $item['uid'])) {
$result = self::delete($item['uri'], $item['uid']);
Logger::notice('Delayed post entry deleted', ['result' => $result, 'uri' => $item['uri']]);
self::delete($item['uri'], $item['uid']);
}
if (!empty($id) && (!empty($taglist) || !empty($attachments))) {

View file

@ -623,7 +623,7 @@ class Feed
'taglist' => $taglist, 'attachments' => $attachments];
}
} else {
Logger::info('Post already crated or exists in the delayed posts queue', ['uri' => $item["uri"]]);
Logger::info('Post already crated or exists in the delayed posts queue', ['uid' => $item['uid'], 'uri' => $item["uri"]]);
}
}
@ -634,7 +634,7 @@ class Feed
// Posts shouldn't be delayed more than a day
$interval = min(1440, self::getPollInterval($contact));
$delay = max(round(($interval * 60) / $total), 60 * $min_posting);
Logger::notice('Got posting delay', ['delay' => $delay, 'interval' => $interval, 'items' => $total, 'cid' => $contact['id'], 'url' => $contact['url']]);
Logger::info('Got posting delay', ['delay' => $delay, 'interval' => $interval, 'items' => $total, 'cid' => $contact['id'], 'url' => $contact['url']]);
} else {
$delay = 0;
}
@ -644,7 +644,6 @@ class Feed
foreach ($postings as $posting) {
if ($delay > 0) {
$publish_time = time() + $post_delay;
Logger::notice('Got publishing date', ['delay' => $delay, 'cid' => $contact['id'], 'url' => $contact['url']]);
$post_delay += $delay;
} else {
$publish_time = time();
@ -653,12 +652,6 @@ class Feed
$last_publish = DI::pConfig()->get($posting['item']['uid'], 'system', 'last_publish', 0, true);
$next_publish = max($last_publish + (60 * $min_posting), time());
if ($publish_time < $next_publish) {
Logger::notice('Adapting publish time',
['last' => date(DateTimeFormat::MYSQL, $last_publish),
'next' => date(DateTimeFormat::MYSQL, $next_publish),
'publish' => date(DateTimeFormat::MYSQL, $publish_time),
'uid' => $posting['item']['uid'], 'cid' => $posting['item']['contact-id'],
'uri' => $posting['item']["uri"]]);
$publish_time = $next_publish;
}
$publish_at = date(DateTimeFormat::MYSQL, $publish_time);