Save to database #13

Merged
haylan merged 42 commits from save-to-database into main 2026-07-12 21:51:57 +00:00
Showing only changes of commit fcf841f7ad - Show all commits
+12 -2
View File
@@ -19,7 +19,7 @@ final class ContributionAggregator
/** @return array<string, int> */
public function aggregate(): array
{
$contributions = [];
$pending = [];
/** @var ProviderInterface $provider */
foreach ($this->providers as $provider) {
@@ -28,7 +28,17 @@ final class ContributionAggregator
}
try {
foreach ($provider->fetch() as $date => $count) {
$pending[] = [$provider, $provider->startFetch()];
} catch (\Throwable $e) {
$this->logger->warning(sprintf('%s fetch failed: %s', $provider::class, $e->getMessage()), ['exception' => $e]);
}
}
$contributions = [];
foreach ($pending as [$provider, $handle]) {
try {
foreach ($provider->resolveFetch($handle) as $date => $count) {
$contributions[$date] = ($contributions[$date] ?? 0) + $count;
}
} catch (\Throwable $e) {