added some time functions into the mining ledger fetcher

This commit is contained in:
2021-03-15 18:43:18 +09:00
parent a158bad0bf
commit 507f4f8a73

View File

@@ -63,6 +63,9 @@ class MiningTaxesLedgers extends Command
//Set the task as started //Set the task as started
$task->SetStartStatus(); $task->SetStartStatus();
//Get the current time to mark when the process started
$startTime = time();
//Get the site configuration which holds some data we need //Get the site configuration which holds some data we need
$config = config('esi'); $config = config('esi');
//Get the observers from the database //Get the observers from the database
@@ -97,6 +100,8 @@ class MiningTaxesLedgers extends Command
$ledgers = json_decode($response->raw); $ledgers = json_decode($response->raw);
foreach($ledgers as $ledger) { foreach($ledgers as $ledger) {
$startLedgerTime = time();
//Get some basic information we need to work with //Get some basic information we need to work with
$charName = $lookup->CharacterIdToName($ledger->character_id); $charName = $lookup->CharacterIdToName($ledger->character_id);
//Get the type name from the ledger ore stuff //Get the type name from the ledger ore stuff
@@ -126,12 +131,18 @@ class MiningTaxesLedgers extends Command
'quantity' => $ledger->quantity, 'quantity' => $ledger->quantity,
'amount' => $amount, 'amount' => $amount,
]); ]);
printf("Current cycle time for this ledger entry is: " . time() - $startLedgerTime . "s.\r\n");
} }
printf("Current time taken is: " . time() - $startTime . "s.\r\n");
} }
//Clean up old data //Clean up old data
//Ledger::where(['updated_at', '<', Carbon::now()->subDays(120)])->delete(); //Ledger::where(['updated_at', '<', Carbon::now()->subDays(120)])->delete();
printf("Total time taken is: " . time() - $startTime . "s.\r\n");
//Return 0 //Return 0
return 0; return 0;
} }