Slow form submission with RedirectLocal result

Topics: General, Troubleshooting
Jul 26, 2013 at 12:02 AM
Edited Jul 26, 2013 at 12:39 AM
[RESOLVED]

I discovered the cause. I had the warmup module set to trigger on new content being published. However, the warmup module is getting only 404s because the URL I've got in settings isn't resolving (hosting issue... host resolves to external IP when should resolve to internal IP).

[ORIGINAL POST]

I have a controller action for a form submission (see code below). When I submit the form, the controller action gets hit immediately and the code runs quite quickly. However, after it returns, the page just hangs for anywhere from 10-30s and even worse on shared hosting.

I'm redirecting to the same page as the form. This page loads very quickly (<1s) on a GET.

I put a breakpoint in the debugger on the controller action, then on the view which loads. I can see the delay here between when the controller returns the redirect and when the view gets hit.

Does anyone know why this redirect could be taking so long to return?

Thanks!

Image
[HttpPost, ActionName("Create")]
[FormValueRequired("submit.Save")]
public ActionResult CreatePOST(string returnUrl)
{
    var referPatientSubmission = _contentManager.New("ReferPatientSubmission");
    var referPatientSubmissionPart = referPatientSubmission.As<ReferPatientSubmissionPart>();

    dynamic model = _contentManager.UpdateEditor(referPatientSubmission, this);

    referPatientSubmissionPart.DateCreated = DateTime.Now;

    _services.ContentManager.Create(referPatientSubmission, VersionOptions.Draft);

    if (!ModelState.IsValid)
    {
        _transactionManager.Cancel();
        foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage))
        {
            _services.Notifier.Add(NotifyType.Error, T(error));
        }
    }
    else
    {
        _services.ContentManager.Publish(referPatientSubmission);

        TempData["ShowConfirmationMessage"] = true;
        TempData["ReferPatientNumber"] = referPatientSubmission.Id;

        if (referPatientSubmissionPart.IsSignedUpNewsletter)
        {
            _vitalCallServices.Subscribe(referPatientSubmissionPart.ReferrerFirstName + " " + referPatientSubmissionPart.ReferrerSurname, referPatientSubmissionPart.ReferrerEmail, "Referrer");
        }
    }

    return this.RedirectLocal(returnUrl, "~/");
}