# 重建百万级上传数据耗时太长？试试添加这个模板！

**URL:** <https://meta.discourse.org/t/rebuilds-taking-a-long-time-with-a-large-number-of-uploads-chown-performance/410278>\
**Category:** Self-hosting\
**Created:** [2026年八月17日 21:13 UTC](https://meta.discourse.org/t/rebuilds-taking-a-long-time-with-a-large-number-of-uploads-chown-performance/410278 "2026-08-17T21:13:29Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [2026年八月18日 19:08 UTC](https://meta.discourse.org/t/rebuilds-taking-a-long-time-with-a-large-number-of-uploads-chown-performance/410278/6 "2026-08-18T19:08:18Z")

</div>

我们先尝试一个更简单的版本。这个版本不会并行执行任何操作，但会跳过那些已经具有正确权限的文件，不再对其执行 `chown`。这是我们在 discourse\_docker 其他部分已经在使用的模式：

> <https://github.com/discourse/discourse_docker/pull/1115>
>
> The web template runs \`chown -R discourse:www-data\` over many directories on eve…ry rebuild. This rewrites the ownership even when it's already correct.
> 
> Instead, we can use \`find\` to select only the files with wrong ownership. We already use this pattern for \`$home\` in the \`web:\` hook of this template. (see aef8682f1e9961d82b98aab87c7e47e0f08a6c52)

---

_[View the full topic](https://meta.discourse.org/t/rebuilds-taking-a-long-time-with-a-large-number-of-uploads-chown-performance/410278)._
