# 邀请链接的生成是否能防止数据竞争？

**URL:** <https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878>\
**Category:** Development\
**Created:** [2025年十月16日 16:27 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878 "2025-10-16T16:27:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Willy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/willy/32/499930_2.png) [@Willy](https://meta.discourse.org/u/Willy)\
**Post date:** [2025年十月16日 16:27 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/1 "2025-10-16T16:27:51Z")

</div>

我想在每次用户提交请求时创建邀请链接，但如果发生数据争用，即两个用户同时请求 Discourse 邀请链接，我担心其中一个甚至两个用户都无法收到链接，因为 Discourse 可能不知道如何处理数据争用。这对我来说至关重要，因为他们已经付费获得该链接，并且提前创建链接不是一个选项，因为这会使项目架构过于复杂。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年十月16日 16:31 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/2 "2025-10-16T16:31:37Z")

</div>

我认为不应该有问题。

---

<div class="post-metadata">

**Author:** ![Willy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/willy/32/499930_2.png) [@Willy](https://meta.discourse.org/u/Willy)\
**Post date:** [2025年十月16日 16:44 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/3 "2025-10-16T16:44:05Z")

</div>

即使同时有成千上万（夸张说法）个请求？

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年十月16日 17:49 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/4 "2025-10-16T17:49:31Z")

</div>

不用看代码，是的。在 Postgres 和 Rails 之间，我很确定他们考虑了竞态条件。这并不是一个真正困难或意想不到的问题。

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2025年十月25日 19:37 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/5 "2025-10-25T19:37:45Z")

</div>

@willy 杰伊的回答让你满意吗？

---

<div class="post-metadata">

**Author:** ![Willy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/willy/32/499930_2.png) [@Willy](https://meta.discourse.org/u/Willy)\
**Post date:** [2025年十月28日 05:20 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/6 "2025-10-28T05:20:10Z")

</div>

嗯，他没看代码就这么说了，所以我把问题留着，以防看代码的人有什么想说的。

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2025年十月28日 18:18 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/7 "2025-10-28T18:18:04Z")

</div>

我将此主题移至 #Dev，因为它是一个开发者问题。

我自己不是开发者，但我知道 Discourse 被数以万计的网站和数以亿计的用户使用，而且我从未听说过有邀请丢失的案例。Discourse 是一个为可扩展性而构建的平台。

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2025年十一月27日 18:18 UTC](https://meta.discourse.org/t/is-the-generation-of-invitation-links-secure-against-data-races/385878/8 "2025-11-27T18:18:20Z")

</div>

此主题在最后一次回复后 30 天自动关闭。不再允许新的回复。
