Skip to content

Commit

Permalink
Fixes for returning too early
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed May 8, 2020
1 parent 232a59b commit 2797b47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/Commands/ForceSend.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Turbo124\Beacon\Jobs\BatchMetrics;


Expand All @@ -19,7 +20,7 @@ class ForceSend extends Command
*/
protected $description = 'Forces the beacon queue to send data to the endpoint.';


protected $log = '';

public function handle()
{
Expand All @@ -30,9 +31,11 @@ public function handle()
foreach($metric_types as $type)
{
$metrics = Cache::get(config('beacon.cache_key') . '_' . $type);
}

$this->logMessage("I have " . count($metrics) . "pending to be sent");
if(is_array($metrics))
$this->logMessage("I have " . count($metrics) . "pending to be sent");

}

BatchMetrics::dispatchNow();

Expand All @@ -41,9 +44,13 @@ public function handle()
foreach($metric_types as $type)
{
$metrics = Cache::get(config('beacon.cache_key') . '_' . $type);

if(is_array($metrics))
$this->logMessage("I have " . count($metrics) . "pending to be sent");
}

$this->logMessage("I have " . count($metrics) . "pending to be sent");


}

private function logMessage($str)
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/BatchMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function handle()
$metrics = Cache::get(config('beacon.cache_key') . '_' . $type);

if(!is_array($metrics))
return;
continue;

$generator = new Generator();
$generator->batchFire($metrics);
Expand Down

0 comments on commit 2797b47

Please sign in to comment.