主题列表预览(旧版)

你好,感谢你们开发了这么棒的插件!

遗憾的是,在最近的更新后,那些未直接托管在 Discourse 上的图片在网格或瓷砖视图中不再显示。能否请您检查一下这个问题?

例如,如果帖子中的图片来自其他服务器(如 Blogger、Picasa 等),它们就不再显示了。之前,这些图片一直能正常显示,没有任何问题。

1 个赞

缩略图现在由 Discourse 核心生成,我对此几乎无法施加影响。

大部分缩略图生成逻辑已被移除,交由 Discourse 处理。

你可以在这里提出相关建议:Theme modifiers: A brief introduction

2 个赞

谢谢!我刚刚在那里回复了。由于我的所有图片都不是托管在本地服务器上,我对这些更新持怀疑态度。

2 个赞

我相信,如果您通过设置将“上传”托管在远程服务器上,它仍然可以正常工作,但它将不再直接链接到远程站点和非关联的第三方。

鉴于这部分代码现在由核心处理,在插件中管理它已不再合理。您跟进此事是完全正确的 :+1:

4 个赞

谢谢。我理解目前的情况。由于我的网站使用其他服务器托管图片,因此修复起来并不容易。现在,要将大量帖子迁移到关联服务器非常困难,而本地服务器又无法承载如此大的数据量。

1 个赞

我遇到的问题在于,启用事件插件后,缩略图在移动端不再显示,正如之前讨论的那样。我以为你指的就是这个问题。

缩略图在我这里显示正常。你确定已按照 @fzngagan 的要求更新了事件吗?

2 个赞

他肯定是在我测试完之后就合并了,谢谢大家,现在一切正常了!

3 个赞

我昨天更新了系统,之后性能表现一直较差。查看分析器后,我发现是 TLP 执行的这条查询导致了问题——也许这里缺少某个索引?

有趣的是,即使我在安全模式下运行网站,这条查询仍然会出现:thinking:

1 个赞

功能图片。此查询多年来(甚至数年!)未曾改变。您确定这是一个新问题吗?

您是否按标签创建日期排序?这几乎肯定会是一个复杂的查询。按“最新”排序会更友好。

您可以暂时关闭此功能。

主题组件使用的是核心 API。如果它给您带来困扰,您随时可以切换并暂时使用核心 API。

1 个赞

我想这是我升级到 PG12 之后才出现的新情况。我们确实需要按标签创建日期进行排序,这算是我们社区的一个核心“功能”。如果切换到 TC,我会错过什么呢?

附:我模糊地记得几年前曾和你讨论过关于特色行的同一问题,我会再仔细查一下。

2 个赞

您确定 PG 12 升级已完成重新索引吗?许多用户报告称,在该过程中曾出现性能下降的情况(这些报告与 TLP 无关)

顺便提一下,仔细想想,可能还有其他变化:现在需要关联 topic_thumbnails 表,但这也是一段时间前的事了,且未收到其他相关报告。我怀疑之前可能直接使用 Topic 对象中的 image_url 热链接,那样会更快(少一次关联),但由于核心代码的变更,这种方式已不再可行。这可能也是导致问题的原因之一。

1 个赞

是的,重新索引已完成。按主题创建日期排序也存在同样的问题。以下是两个查询的 EXPLAIN 输出:

按标记日期排序:

discourse=# explain SELECT "topics"."id", "topics"."title", "topics"."last_posted_at", "topics"."created_at", "topics"."updated_at", "topics"."views", "topics"."posts_count", "topics"."user_id", "topics"."last_post_user_id", "topics"."reply_count", "topics"."featured_user1_id", "topics"."featured_user2_id", "topics"."featured_user3_id", "topics"."deleted_at", "topics"."highest_post_number", "topics"."like_count", "topics"."incoming_link_count", "topics"."category_id", "topics"."visible", "topics"."moderator_posts_count", "topics"."closed", "topics"."archived", "topics"."bumped_at", "topics"."has_summary", "topics"."archetype", "topics"."featured_user4_id", "topics"."notify_moderators_count", "topics"."spam_count", "topics"."pinned_at", "topics"."score", "topics"."percent_rank", "topics"."subtype", "topics"."slug", "topics"."deleted_by_id", "topics"."participant_count", "topics"."word_count", "topics"."excerpt", "topics"."pinned_globally", "topics"."pinned_until", "topics"."fancy_title", "topics"."highest_staff_post_number", "topics"."featured_link", "topics"."reviewable_score", "topics"."image_upload_id" 
discourse-# FROM "topics" 
discourse-# INNER JOIN "topic_tags" 
discourse-# ON "topic_tags"."topic_id" = "topics"."id" 
discourse-# INNER JOIN "tags" ON "tags"."id" = "topic_tags"."tag_id" 
discourse-# WHERE ("topics"."deleted_at" IS NULL) 
discourse-# AND "topics"."visible" = TRUE 
discourse-# AND (NOT topics.closed AND NOT topics.archived AND topics.deleted_at IS NULL) 
discourse-# AND (topics.image_upload_id in (
discourse(#         SELECT image_upload_id FROM topic_thumbnails
discourse(#       ))
discourse-# AND (tags.id IN (1)) 
discourse-# 
discourse-# ORDER BY (
discourse(#  SELECT created_at FROM topic_tags
discourse(#         WHERE topic_id = topics.id
discourse(#         AND tag_id IN (1)
discourse(#         LIMIT 1
discourse(# )
discourse-# 
discourse-# DESC LIMIT 6; 
                                                                    QUERY PLAN                                                         
            
---------------------------------------------------------------------------------------------------------------------------------------
------------
 Limit  (cost=2631719.94..2631719.95 rows=6 width=569)
   ->  Sort  (cost=2631719.94..2631721.73 rows=717 width=569)
         Sort Key: ((SubPlan 1)) DESC
         ->  Nested Loop  (cost=0.43..2631707.09 rows=717 width=569)
               ->  Seq Scan on tags  (cost=0.00..4.51 rows=1 width=4)
                     Filter: (id = 1)
               ->  Nested Loop  (cost=0.43..2625737.13 rows=717 width=565)
                     ->  Seq Scan on topic_tags  (cost=0.00..860.33 rows=1539 width=8)
                           Filter: (tag_id = 1)
                     ->  Index Scan using topics_pkey on topics  (cost=0.43..1705.57 rows=1 width=561)
                           Index Cond: (id = topic_tags.topic_id)
                           Filter: ((deleted_at IS NULL) AND visible AND (NOT closed) AND (NOT archived) AND (deleted_at IS NULL) AND (
SubPlan 2))
                           SubPlan 2
                             ->  Seq Scan on topic_thumbnails  (cost=0.00..2966.64 rows=171664 width=8)
               SubPlan 1
                 ->  Limit  (cost=0.29..8.31 rows=1 width=8)
                       ->  Index Scan using index_topic_tags_on_topic_id_and_tag_id on topic_tags topic_tags_1  (cost=0.29..8.31 rows=1
 width=8)
                             Index Cond: ((topic_id = topics.id) AND (tag_id = 1))
 JIT:
   Functions: 25
   Options: Inlining true, Optimization true, Expressions true, Deforming true
(21 rows)

按主题日期排序:

discourse=# explain SELECT "topics"."id", "topics"."title", "topics"."last_posted_at", "topics"."created_at", "topics"."updated_at", "topics"."views", "topics"."posts_count", "topics"."user_id", "topics"."last_post_user_id", "topics"."reply_count", "topics"."featured_user1_id", "topics"."featured_user2_id", "topics"."featured_user3_id", "topics"."deleted_at", "topics"."highest_post_number", "topics"."like_count", "topics"."incoming_link_count", "topics"."category_id", "topics"."visible", "topics"."moderator_posts_count", "topics"."closed", "topics"."archived", "topics"."bumped_at", "topics"."has_summary", "topics"."archetype", "topics"."featured_user4_id", "topics"."notify_moderators_count", "topics"."spam_count", "topics"."pinned_at", "topics"."score", "topics"."percent_rank", "topics"."subtype", "topics"."slug", "topics"."deleted_by_id", "topics"."participant_count", "topics"."word_count", "topics"."excerpt", "topics"."pinned_globally", "topics"."pinned_until", "topics"."fancy_title", "topics"."highest_staff_post_number", "topics"."featured_link", "topics"."reviewable_score", "topics"."image_upload_id" FROM "topics" INNER JOIN "topic_tags" ON "topic_tags"."topic_id" = "topics"."id" INNER JOIN "tags" ON "tags"."id" = "topic_tags"."tag_id" WHERE ("topics"."deleted_at" IS NULL) AND "topics"."visible" = TRUE AND (NOT topics.closed AND NOT topics.archived AND topics.deleted_at IS NULL) AND (topics.image_upload_id in (
        SELECT image_upload_id FROM topic_thumbnails
      )) AND (tags.id IN (1)) ORDER BY (SELECT created_at FROM topic_tags
        WHERE topic_id = topics.id
        AND tag_id IN (1)
        LIMIT 1)
        DESC LIMIT 6; 
                                                                    QUERY PLAN                                                         
            
---------------------------------------------------------------------------------------------------------------------------------------
------------
 Limit  (cost=2631719.94..2631719.95 rows=6 width=569)
   ->  Sort  (cost=2631719.94..2631721.73 rows=717 width=569)
         Sort Key: ((SubPlan 1)) DESC
         ->  Nested Loop  (cost=0.43..2631707.09 rows=717 width=569)
               ->  Seq Scan on tags  (cost=0.00..4.51 rows=1 width=4)
                     Filter: (id = 1)
               ->  Nested Loop  (cost=0.43..2625737.13 rows=717 width=565)
                     ->  Seq Scan on topic_tags  (cost=0.00..860.33 rows=1539 width=8)
                           Filter: (tag_id = 1)
                     ->  Index Scan using topics_pkey on topics  (cost=0.43..1705.57 rows=1 width=561)
                           Index Cond: (id = topic_tags.topic_id)
                           Filter: ((deleted_at IS NULL) AND visible AND (NOT closed) AND (NOT archived) AND (deleted_at IS NULL) AND (
SubPlan 2))
                           SubPlan 2
                             ->  Seq Scan on topic_thumbnails  (cost=0.00..2966.64 rows=171664 width=8)
               SubPlan 1
                 ->  Limit  (cost=0.29..8.31 rows=1 width=8)
                       ->  Index Scan using index_topic_tags_on_topic_id_and_tag_id on topic_tags topic_tags_1  (cost=0.29..8.31 rows=1
 width=8)
                             Index Cond: ((topic_id = topics.id) AND (tag_id = 1))
 JIT:
   Functions: 25
   Options: Inlining true, Optimization true, Expressions true, Deforming true
(21 rows)
2 个赞

有用。谢谢。

抱歉,我不确定什么时候能处理这个。

另外请注意,新的 join 可能会有所改进 但我无法将其移除。(哦,我确实可以!)。

1 个赞

好的,我已经与 @bartv 线下合作改进了这一点。

这仅影响插件,不影响 TC:

建议升级以利用此改进,这对于使用特色图片的网站来说是一个巨大的提升。

5 个赞

你真是个摇滚明星!:guitar:

3 个赞

Bart,你详尽的侦探工作也至关重要,谢谢。

3 个赞

你好,我已在容器的 app.yml 中添加了 git clone 地址,但当我尝试重建应用时出现错误:

(<unknown>): 在扫描纯标量时,第 91 行第 13 列发现制表符,违反了缩进规则 -e LANG=en_US.UTF-8

网站也无法正常工作。

我删除了该插件的 git clone 地址后,一切又恢复正常了。

1 个赞

我认为您的问题并非此插件所特有。您不能在 app.yml 中使用制表符,请使用空格。

2 个赞

好的,抱歉,我复制粘贴了插件的最新一行并更改了 git clone 的 URL。现在它起作用了,谢谢:slight_smile:

2 个赞