1
0
Fork 0
mirror of synced 2024-07-04 14:10:33 +12:00

Merge pull request #4765 from appwrite/lohanidamodar-patch-2

fix hourly stats
This commit is contained in:
Christy Jacob 2022-11-23 13:26:57 +05:30 committed by GitHub
commit 948b14d139
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,8 +27,8 @@ App::get('/v1/project/usage')
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$periods = [
'24h' => [
'period' => '30m',
'limit' => 48,
'period' => '1h',
'limit' => 24,
],
'7d' => [
'period' => '1d',
@ -82,7 +82,7 @@ App::get('/v1/project/usage')
while ($backfill > 0) {
$last = $limit - $backfill - 1; // array index of last added metric
$diff = match ($period) { // convert period to seconds for unix timestamp math
'30m' => 1800,
'1h' => 3600,
'1d' => 86400,
};
$stats[$metric][] = [