Skip to content

Instantly share code, notes, and snippets.

@reshadman
Last active August 29, 2015 14:03
Show Gist options
  • Save reshadman/2c4207c8b559e5a9b35a to your computer and use it in GitHub Desktop.
Save reshadman/2c4207c8b559e5a9b35a to your computer and use it in GitHub Desktop.
Pusher logic
<?php
// I called following loop 5 times
for ($i = 1 ; $i <= 200; $i++)
{
\Queue::push(function ($job){
if (! \Cache::has('start_time')){
\Cache::put('start_time', time() , 1500); // global start time
}
sleep(10); //mock network delay for 25 requests
$id = 25; // number of async request
if (\Cache::has('id'))
{
$id = \Cache::get('id') + $id;
}
\Cache::put('id' , $id,10000);
\Log::info($id);
\Cache::put('finish_time', time() , 10000);
$job->delete();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment