I have a WordPress function which runs every minute on a cron job. The $wpdb->insert code is as simple as this:
global $wpdb;
$wpdb->bitcoin_price = $wpdb->prefix . 'bitcoin';
$gbpJson = @json_decode(file_get_contents('https://www.cryptocompare.com/api/data/price?fsym=BTC&tsyms=GBP'));
$gbpArray = $gbpJson->Data[0];
$supplyJson = @json_decode(file_get_contents('https://www.cryptocompare.com/api/data/coinsnapshotfullbyid/?id=1182'));
$supplyArray = $supplyJson->Data->General;
$date = date('Y-m-d H:i:s', $gbpArray->LastUpdateTS);
// This is inserting duplicates
$wpdb->insert($wpdb->bitcoin_price, array(
"date" => $date,
"gbp" => $gbpArray->Price,
"supply" => $supplyArray->TotalCoinsMined
));
Yet when this runs every minute, I can find anything from 1 to 8 duplicate rows with exactly the same timestamp and data.