Use routing quota instead of monthly quota
This commit is contained in:
@@ -153,7 +153,7 @@ class RoutingConfig(ServiceConfig):
|
|||||||
elif self._routing_provider == self.MAPBOX_PROVIDER:
|
elif self._routing_provider == self.MAPBOX_PROVIDER:
|
||||||
self._mapbox_api_keys = self._db_config.mapbox_routing_api_keys
|
self._mapbox_api_keys = self._db_config.mapbox_routing_api_keys
|
||||||
self._mapbox_service_params = self._db_config.mapbox_routing_service_params
|
self._mapbox_service_params = self._db_config.mapbox_routing_service_params
|
||||||
self._set_monthly_quota()
|
self._routing_quota = self._get_effective_monthly_quota(self.QUOTA_KEY)
|
||||||
self._set_soft_limit()
|
self._set_soft_limit()
|
||||||
self._period_end_date = date_parse(self._redis_config[self.PERIOD_END_DATE])
|
self._period_end_date = date_parse(self._redis_config[self.PERIOD_END_DATE])
|
||||||
|
|
||||||
@@ -193,8 +193,8 @@ class RoutingConfig(ServiceConfig):
|
|||||||
return self._mapbox_service_params
|
return self._mapbox_service_params
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def monthly_quota(self):
|
def routing_quota(self):
|
||||||
return self._monthly_quota
|
return self._routing_quota
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def period_end_date(self):
|
def period_end_date(self):
|
||||||
@@ -204,9 +204,6 @@ class RoutingConfig(ServiceConfig):
|
|||||||
def soft_limit(self):
|
def soft_limit(self):
|
||||||
return self._soft_limit
|
return self._soft_limit
|
||||||
|
|
||||||
def _set_monthly_quota(self):
|
|
||||||
self._monthly_quota = self._get_effective_monthly_quota(self.QUOTA_KEY)
|
|
||||||
|
|
||||||
def _set_soft_limit(self):
|
def _set_soft_limit(self):
|
||||||
if self.SOFT_LIMIT_KEY in self._redis_config and self._redis_config[self.SOFT_LIMIT_KEY].lower() == 'true':
|
if self.SOFT_LIMIT_KEY in self._redis_config and self._redis_config[self.SOFT_LIMIT_KEY].lower() == 'true':
|
||||||
self._soft_limit = True
|
self._soft_limit = True
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class QuotaChecker:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def __check_routing_quota(self):
|
def __check_routing_quota(self):
|
||||||
user_quota = self._user_service_config.monthly_quota
|
user_quota = self._user_service_config.routing_quota
|
||||||
today = date.today()
|
today = date.today()
|
||||||
service_type = self._user_service_config.service_type
|
service_type = self._user_service_config.service_type
|
||||||
current_used = self._user_service.used_quota(service_type, today)
|
current_used = self._user_service.used_quota(service_type, today)
|
||||||
|
|||||||
Reference in New Issue
Block a user