Skip to content

Commit

Permalink
Minor change when pushing analytics - empty the array!
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed Oct 5, 2022
1 parent 4a0c9c6 commit 05d8d24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 1 addition & 10 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,10 @@ public function batchFire($metric_array)
if(!is_array($metric_array) || count($metric_array) == 0)
return;

// $data['metrics'] = $metric_array;

$client = $this->httpClient();

try {

//$response = $client->request('POST',$this->endPoint($metric_array[0]->type), ['form_params' => $data]);

$batch_of = 40;
$batch = array_chunk($metric_array, $batch_of);

Expand All @@ -126,22 +122,17 @@ public function batchFire($metric_array)

}

// $responses = Promise\Utils::unwrap($promises);



} catch (RequestException $e) {

info($e->getMessage());
// info($e->getMessage());
}

}

private function sendPromise($promises)
{
$responses = Promise\Utils::unwrap($promises);
// $responses = Promise\Utils::settle($promises)->wait();

}

}
3 changes: 2 additions & 1 deletion src/Jobs/BatchMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ public function handle()

if(!is_array($metrics))
continue;

Cache::put(config('beacon.cache_key') . '_' . $type, []);

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

Cache::put(config('beacon.cache_key') . '_' . $type, []);
}

}
Expand Down

0 comments on commit 05d8d24

Please sign in to comment.