Fix speed and error

This commit is contained in:
2026-09-16 12:22:27 +02:00
parent 45a883319a
commit bda7b311e3
5 changed files with 149 additions and 54 deletions
+7 -5
View File
@@ -401,7 +401,9 @@ function jira_fetch_project_statuses(string $domain, string $email, string $apiT
return strcasecmp($a['name'], $b['name']);
});
fociz_cache_set($cacheKey, $statuses, 3600);
fociz_cache_set($cacheKey, $statuses, 86400); // 24 uur cache
} else {
fociz_cache_set($cacheKey, [], 1800); // 30 min negatieve cache
}
return $statuses;
@@ -1195,7 +1197,7 @@ function jira_get_dashboard_data(int $userId, bool $forceRefresh = false): array
return array_merge($cachedData, ['from_cache' => true]);
}
if (session_status() === PHP_SESSION_ACTIVE && !empty($_SESSION[$cacheKey]['data'])) {
if (($_SESSION[$cacheKey]['timestamp'] ?? 0) > (time() - 60)) {
if (($_SESSION[$cacheKey]['timestamp'] ?? 0) > (time() - 180)) {
return array_merge($_SESSION[$cacheKey]['data'], ['from_cache' => true]);
}
}
@@ -1230,8 +1232,8 @@ function jira_get_dashboard_data(int $userId, bool $forceRefresh = false): array
$targetProjKeys = array_fill_keys(['SD', 'IN', 'AAN', 'GEN'], true);
}
// Ophalen van teamtaken binnen de relevante projecten (met paginatie tot max 500)
$teamRes = jira_fetch_team_issues($domain, $email, $apiToken, array_keys($targetProjKeys), 500);
// Ophalen van teamtaken binnen de relevante projecten (met paginatie tot max 200)
$teamRes = jira_fetch_team_issues($domain, $email, $apiToken, array_keys($targetProjKeys), 200);
// Ophalen van Jira statussen
$availableStatuses = jira_fetch_statuses($domain, $email, $apiToken);
@@ -1281,7 +1283,7 @@ function jira_get_dashboard_data(int $userId, bool $forceRefresh = false): array
'project_statuses' => $projectStatusesMap,
];
fociz_cache_set($cacheKey, $data, 60);
fociz_cache_set($cacheKey, $data, 180); // 3 minuten cache
if (session_status() === PHP_SESSION_ACTIVE) {
$_SESSION[$cacheKey] = [