# 迁移至 S3 的任务因请求过多而失败

**URL:** <https://meta.discourse.org/t/migrate-to-s3-task-fails-for-placing-too-many-requests/106305>\
**Category:** Self-hosting\
**Tags:** s3\
**Created:** [2019 年1 月 11 日 18:20 UTC](https://meta.discourse.org/t/migrate-to-s3-task-fails-for-placing-too-many-requests/106305 "2019-01-11T18:20:32Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![marcozambi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcozambi/32/119505_2.png) [@marcozambi](https://meta.discourse.org/u/marcozambi)\
发布日期： [2019 年1 月 11 日 18:20 UTC](https://meta.discourse.org/t/migrate-to-s3-task-fails-for-placing-too-many-requests/106305/1 "2019-01-11T18:20:32Z")

</div>

所以，我为了将本地存储的上传文件迁移到 DigitalOcean Spaces 已经奋战了几天，经过一番挣扎后，我成功运行了 `rake uploads:migrate_to_s3`，但到目前为止，我的所有尝试均未成功。

一些背景信息：

- 我正在运行 Discourse 2.2 beta 7 +117
- 我已成功配置 Discourse 将上传文件和备份存储到 Spaces，并且它们已稳定运行多日
- 我已按照[此处说明](https://meta.discourse.org/t/migration-of-system-stored-images-to-s3-after-configuration-change/19605/52?u=marcozambi)在 app.yml 中定义了环境变量，但我不得不省略 DISCOURSE\_S3\_CDN\_URL（而 DISCOURSE\_S3\_REGION、DISCOURSE\_S3\_ACCESS\_KEY\_ID、DISCOURSE\_S3\_SECRET\_ACCESS\_KEY、DISCOURSE\_S3\_BUCKET 均已设置），否则此更改会导致 Discourse 在重建后在 Spaces 上查找 **所有** 资源（包括 JavaScript 文件），这既不好也不是我需要的 👼
- 我已多次运行该 rake 任务数小时，但每次运行一段时间后都会遇到以下错误，脚本随即崩溃。

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/b/eb2485dcac2acc1e8fa738094863fa440954160f.png)

问题：

1. 我该如何限制该脚本的运行速度？
2. 为什么我们要依赖那些可能破坏用户界面的环境变量设置？难道我们之前通过 Web UI 配置的数据不足以运行 migrate\_to\_s3 任务吗？

---

_[View the full topic](https://meta.discourse.org/t/migrate-to-s3-task-fails-for-placing-too-many-requests/106305)._
