Is the generation of invitation links secure against data races?

I want to create invitation links every time a user submits a request, but if there is a data race in which two users request a Discourse invitation link at the same time, I am afraid that one or even both of them will not receive a link because Discourse may not know how to handle the data race. This is critical for me since they have paid to obtain it, and creating them in advance is not an option because that would complicate the project architecture too much.

I don’t think there should be any problems.

1 Like

Even with a thousand (to exaggerate) requests at the same time?

Without looking at the code, yes. Between Postgres and Rails, I’m pretty sure they thought of race conditions. It’s not really a difficult or unexpected problem.

1 Like

@willy did Jay answer your question to your satisfaction?

1 Like

Well, he said without reading the code, so I left the question open in case anyone who read the code has something to say.

I am moving this topic to Dev because it is a developer question.

I am not a developer myself but do know that Discourse is used by many thousands of sites with many millions of users, and I have never heard of any case where an invitation got lost. Discourse is a platform that is built for scale.

1 Like