# 爬虫限流的处理

**URL:** <https://meta.discourse.org/t/handling-of-crawler-throttling/278769>\
**Category:** Product Support\
**Tags:** seo\
**Created:** [2023 年9 月 12 日 18:12 UTC](https://meta.discourse.org/t/handling-of-crawler-throttling/278769 "2023-09-12T18:12:14Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![vchuravy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vchuravy/32/120525_2.png) [@vchuravy](https://meta.discourse.org/u/vchuravy)\
发布日期： [2023 年9 月 12 日 18:12 UTC](https://meta.discourse.org/t/handling-of-crawler-throttling/278769/1 "2023-09-12T18:12:14Z")

</div>

我有一个关于爬虫限流是如何实现的一般性问题。

根据 [https://support.google.com/webmasters/answer/48620?hl=en，推荐的](https://support.google.com/webmasters/answer/48620?hl=en%EF%BC%8C%E6%8E%A8%E8%8D%90%E7%9A%84) HTTP 状态码是 429（请求过多）或 503（站点不可用）。

但通过阅读源代码，看起来限流是通过抛出错误来实现的：[discourse/lib/rate\_limiter.rb at 85fddf58bc1e751d0ac5b8192a630c59a34aed7d · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/85fddf58bc1e751d0ac5b8192a630c59a34aed7d/lib/rate_limiter.rb#L129)

我的 Ruby on Rails 时代早已过去，但我假设这会引发一个通用的 505？

Google 爬虫不太理解 discourse 的限流，在 Google Search Console 中，我可以看到在实施限流后，我们的索引量（因此也包括展示量）急剧下降，但这并非由于限流，而是由于 5xx 服务器错误。

我理解在某些情况下可能需要限流实例，如果它们导致过多的流量，但我期望 discourse 会报告 HTTP 429，而不是向爬虫提供 505 内部错误。

---

_[View the full topic](https://meta.discourse.org/t/handling-of-crawler-throttling/278769)._
