Back to Practice

Practice · Scaling · Card 7

The signup is slow. What moves first?

A signup page that takes 3 seconds to respond. The user is waiting on something they don't need to see complete.

The action

The user posts the signup form. The page takes about 3 seconds before redirecting.

def create
  @user = User.new(user_params)
  if @user.save
    WelcomeMailer.with(user: @user).welcome_email.deliver_now
    SegmentClient.track_signup(@user)
    Slack.notify("#new-signups", "#{@user.email} just signed up")
    redirect_to dashboard_path
  else
    render :new
  end
end

The question

Which side effects belong on the synchronous path? Which should move first? What's the question to ask of each one?

Take a moment. For each side effect, ask: does the user need to see this complete before they get their response? The answer for each one decides the synchronous vs background split.