]> git.mxchange.org Git - friendica.git/commitdiff
Issue 9344: Update trending tags hourly
authorMichael <heluecht@pirati.ca>
Sat, 3 Oct 2020 06:10:39 +0000 (06:10 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 3 Oct 2020 06:10:39 +0000 (06:10 +0000)
src/Model/Tag.php
src/Worker/Cron.php

index 7e99ae1a3a99ecff9e30b16d5f80c2e6fac53532..f947b9f898429744b2f427e3dd1fa0fd4619499f 100644 (file)
@@ -526,7 +526,7 @@ class Tag
 
                if (DBA::isResult($tagsStmt)) {
                        $tags = DBA::toArray($tagsStmt);
-                       DI::cache()->set('global_trending_tags-' . $period . '-' . $limit, $tags, Duration::HOUR);
+                       DI::cache()->set('global_trending_tags-' . $period . '-' . $limit, $tags, Duration::DAY);
                        return $tags;
                }
 
@@ -569,7 +569,7 @@ class Tag
 
                if (DBA::isResult($tagsStmt)) {
                        $tags = DBA::toArray($tagsStmt);
-                       DI::cache()->set('local_trending_tags-' . $period . '-' . $limit, $tags, Duration::HOUR);
+                       DI::cache()->set('local_trending_tags-' . $period . '-' . $limit, $tags, Duration::DAY);
                        return $tags;
                }
 
index 43a18ceafc8b355d87224ad1c5245c78baa0153c..8ede97c2e48783ef891a9b24240e46798a49a7a9 100644 (file)
@@ -75,13 +75,13 @@ class Cron
                // Repair entries in the database
                Worker::add(PRIORITY_LOW, 'RepairDatabase');
 
-               // Update trending tags cache for the community page
-               Tag::setLocalTrendingHashtags(24, 20);
-               Tag::setGlobalTrendingHashtags(24, 20);
-
                // Hourly cron calls
                if (DI::config()->get('system', 'last_cron_hourly', 0) + 3600 < time()) {
 
+                       // Update trending tags cache for the community page
+                       Tag::setLocalTrendingHashtags(24, 20);
+                       Tag::setGlobalTrendingHashtags(24, 20);
+
                        // Search for new contacts in the directory
                        if (DI::config()->get('system', 'synchronize_directory')) {
                                Worker::add(PRIORITY_LOW, 'PullDirectory');