Event invites to very large regions result in error 504

Summary

When creating an event on europe or germany level there are a lot of people invited to those events. Germany is 60k people. Bug mentioned in headline happens on beta and production.
I've heard from this bug from Marcel but haven't heard back from him about details why it was working for him but not with my tests on beta/prod.

Steps to reproduce

Create a event on germany or europe level

What is the current bug behavior?

Page is loading for 2 minuten and crashing afterwards with a white page:

  • 504 Gateway Time-out
  • nginx/1.14.1

No event is being added.

What is the expected correct behavior?

Event should be added with fast loding as it used to be

Relevant error messages and/or screenshots

There is a huge peak in sql stats:
load_peak_when_creating_a_germany_event

Possible fixes

Check if there were refactorings.
Check sentry:

Edited by Johannes