@@ -743,7 +743,7 @@ def _get_past_usage_data(datetime_from=None, datetime_to=None, top=5):
743
743
@usage_ns .route ("/past-day" )
744
744
class UsagePastDay (Resource ):
745
745
@usage_ns .response (HTTPStatus .OK , "Providing data about Packit usage" )
746
- @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (hours = 1 ).seconds )
746
+ @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (hours = 1 ).total_seconds () )
747
747
def get (self ):
748
748
yesterday_date = (datetime .now () - timedelta (days = 1 )).strftime ("%Y-%m-%d" )
749
749
return _get_past_usage_data (datetime_from = yesterday_date )
@@ -752,7 +752,7 @@ def get(self):
752
752
@usage_ns .route ("/past-week" )
753
753
class UsagePastWeek (Resource ):
754
754
@usage_ns .response (HTTPStatus .OK , "Providing data about Packit usage" )
755
- @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (hours = 1 ).seconds )
755
+ @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (hours = 1 ).total_seconds () )
756
756
def get (self ):
757
757
past_week_date = (datetime .now () - timedelta (days = 7 )).strftime ("%Y-%m-%d" )
758
758
return _get_past_usage_data (datetime_from = past_week_date )
@@ -761,7 +761,7 @@ def get(self):
761
761
@usage_ns .route ("/past-month" )
762
762
class UsagePastMonth (Resource ):
763
763
@usage_ns .response (HTTPStatus .OK , "Providing data about Packit usage" )
764
- @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (days = 1 ).seconds )
764
+ @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (days = 1 ).total_seconds () )
765
765
def get (self ):
766
766
now = datetime .now ()
767
767
past_month_past_day = now .replace (day = 1 ) - timedelta (days = 1 )
@@ -774,7 +774,7 @@ def get(self):
774
774
@usage_ns .route ("/past-year" )
775
775
class UsagePastYear (Resource ):
776
776
@usage_ns .response (HTTPStatus .OK , "Providing data about Packit usage" )
777
- @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (days = 1 ).seconds )
777
+ @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (days = 1 ).total_seconds () )
778
778
def get (self ):
779
779
now = datetime .now ()
780
780
past_year_date = now .replace (year = now .year - 1 ).strftime ("%Y-%m-%d" )
@@ -784,7 +784,7 @@ def get(self):
784
784
@usage_ns .route ("/total" )
785
785
class UsageTotal (Resource ):
786
786
@usage_ns .response (HTTPStatus .OK , "Providing data about Packit usage" )
787
- @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (days = 1 ).seconds )
787
+ @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (days = 1 ).total_seconds () )
788
788
def get (self ):
789
789
past_date = _DATE_IN_THE_PAST .strftime ("%Y-%m-%d" )
790
790
return _get_past_usage_data (datetime_from = past_date )
@@ -794,7 +794,7 @@ def get(self):
794
794
CHART_DATA_TYPE = list [dict [str , Union [str , int ]]]
795
795
796
796
797
- @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (hours = 1 ).seconds )
797
+ @ttl_cache (maxsize = _CACHE_MAXSIZE , ttl = timedelta (hours = 1 ).total_seconds () )
798
798
def _get_usage_interval_data (
799
799
days : int , hours : int , count : int
800
800
) -> dict [str , Union [str , CHART_DATA_TYPE , dict [str , CHART_DATA_TYPE ]]]:
0 commit comments