How can I flush a json response in a controller?
Maybe obvious for people familiar with Symfony, but was new for me; spent way too long trying to find something so simple:

$json_response = new JsonResponse($my_key_value_array);
$json_response-&gt;send();
$this-&gt;function_that_takes_a_long_time();