symfony/symfony — pull request #10773 by tucksaun (2014-04-24 09:29:16+00:00)
Title: [WebProfilerBundle ] Fixed an edge case on WDT loading

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #6824
| License | MIT
| Doc PR | none

In some case you can notice the WDT just disappears.
By tracking it down, I noticed that the XHR call returns an empty response with 200 as status code, but if you go directly on the _wdt/my_token URL it works correctly.
What's happening is that when you have a slow listener on `kernel.terminate` (for example the SwiftMailer one with a slow connection), you response (and therefore the WDT javascript) is sent and processed by the browser, the XHR call is done, but the Profiler storage didn't happened yet so no profiling data is available and the `ProfilerController` just sends an empty response with 200 as status code.

Here we change to instead send a specific status code, and treat it in javascript by retrying several times before failing.

The question are:
* Is 204 the most appropriate response code?
* Are 500 ms and 5 max retries good values?