title: Laravel dispatch job doesn't run async, hinders execution
body: <p>so in laravel I have a function that posts some content and pushes a job onto a queue and returns some data from the function(not the queue). </p>
  
  <p>Now I thought that laravel queues were supposed to be some sort of async function that makes sure your code remains quick even though there is a lot of data to handle so you put it in a job. But I noticed that my code still needs to wait till the job is finished before it returns data to the user. Here's a log of the script called 2 times but one is with almost no data in the job, and the other has a lot:</p>
  
  <pre><code>[2016-09-08 13:26:50] production.INFO: New alert with Image  
  [2016-09-08 13:26:50] production.INFO: Push is send.  
  [2016-09-08 13:26:50] production.INFO: Alert data is send back.  
  [2016-09-08 13:26:50] production.INFO: New image is valid  
  [2016-09-08 13:26:50] production.INFO: Move file for upload  
  [2016-09-08 13:26:50] production.INFO: Made it to upload  
  
  [2016-09-08 13:28:50] production.INFO: New alert with Image  
  [2016-09-08 13:31:19] production.INFO: Push is send.  
  [2016-09-08 13:31:19] production.INFO: Alert data is send back.  
  [2016-09-08 13:31:20] production.INFO: New image is valid  
  [2016-09-08 13:31:20] production.INFO: Move file for upload  
  [2016-09-08 13:31:20] production.INFO: Made it to upload  
  </code></pre>
  
  <p>As you can see the second ones takes 4 minutes before the application receives further data. This is a deal breaker you can't make users wait so long. So how do I get the job to run async and the function doesn't have to wait for it to finish. </p>
  
  <p>Here's the line where I call the code:</p>
  
  <pre><code>if($isValid === true) {
    $this-&gt;dispatch(new SendPushNotificationAlert($alert));
  
    Log::info('Push is send.');
  }
  </code></pre>
  
  <p>And here is my job: </p>
  
  <pre><code>&lt;?php
  
  namespace App\Jobs;
  
  use DB;
  use Log;
  use App\Alerts;
  use App\Users;
  use App\Jobs\Job;
  use Illuminate\Queue\SerializesModels;
  use Illuminate\Queue\InteractsWithQueue;
  use Illuminate\Contracts\Queue\ShouldQueue;
  use App\Http\Controllers\PushNotificationsController as PushNotificationsController;
  
  class SendPushNotificationAlert extends Job implements ShouldQueue
  {
      use InteractsWithQueue, SerializesModels;
      Protected $alert;
      /**
       * Create a new job instance.
       *
       * @return void
       */
      public function __construct(Alerts $alert)
      {
          //
          $this-&gt;alert = $alert;
      }
  
      /**
       * Execute the job.
       *
       * @return void
       */
      public function handle()
      {
          $alert = $this-&gt;alert;
          $radius = 10000;
          $earthRadius = 6371000;  // earth's mean radius, m
          // first-cut bounding box (in degrees)
          $maxLat = $alert-&gt;lat + rad2deg($radius/$earthRadius);
          $minLat = $alert-&gt;lat - rad2deg($radius/$earthRadius);
          // compensate for degrees longitude getting smaller with increasing latitude
          $maxLon = $alert-&gt;lon + rad2deg($radius/$earthRadius/cos(deg2rad($alert-&gt;lat)));
          $minLon = $alert-&gt;lon - rad2deg($radius/$earthRadius/cos(deg2rad($alert-&gt;lat)));
          $locations = DB::select("
          SELECT id, lat, lon, user_id, name, radius,
            acos(
              sin(?)*
              sin(radians(lat))+
              cos(?)*
              cos(radians(lat))*
              cos(radians(lon) - ?)
            ) * ? AS distance
                FROM (
                    SELECT id, lat, lon, user_id, name, radius
                    FROM user__locations
                    WHERE lat BETWEEN ? AND ?
                      AND lon BETWEEN ? AND ? AND hide = 0
          ) AS FirstCut
          WHERE acos(
              sin(?)*
              sin(radians(lat))+
              cos(?)*
              cos(radians(lat)
            )*
            cos(radians(lon) - ?)
          ) * ? &lt; ?
          ORDER BY distance", [
            deg2rad($alert-&gt;lat),
            deg2rad($alert-&gt;lat),
                  deg2rad($alert-&gt;lon),
            $earthRadius,
                  $minLat,
            $maxLat,
            $minLon,
            $maxLon,
            deg2rad($alert-&gt;lat),
            deg2rad($alert-&gt;lat),
            deg2rad($alert-&gt;lon),
            $earthRadius,
            $radius
          ]);
  
          if(count($locations &gt; 0)) {
            foreach ($locations as $location) {
              if($location-&gt;distance &lt; $location-&gt;radius) {
                if($alert-&gt;anoniem == 0) {
                  $user = Users::find($alert-&gt;user_id);
                  $pushuser = Users::find($location-&gt;user_id);
                  $pushuser-&gt;type = 'location';
                  $pushuser-&gt;locationname = $location-&gt;name;
                  $pushusers[] = $pushuser;
                }
                      }
            }
          }
          if(isset($pushusers)) {
            PushNotificationsController::sendPushnotificationsAlert($pushusers, $user);
          }
      }
  }
  </code></pre>
  
  <p>Anyone knows why the job doesn't run async and what I could do to fix it? </p>