Fix server quota_info function

This commit is contained in:
Jesús Arroyo Torrens 2021-03-31 15:07:00 +02:00
parent 8eed8ac132
commit 40683e435a

View File

@ -122,17 +122,5 @@ RETURNS SETOF cdb_dataservices_server.service_quota_info AS $$
provider = user_routing_config.provider
ret += [[service, monthly_quota, used_quota, soft_limit, provider]]
#-- Observatory
service = 'observatory'
plpy.execute("SELECT cdb_dataservices_server._get_obs_config({0}, {1})".format(plpy.quote_nullable(username), plpy.quote_nullable(orgname)))
user_obs_config = GD["user_obs_config_{0}".format(username)]
user_service = UserMetricsService(user_obs_config, redis_conn)
monthly_quota = user_obs_config.monthly_quota
used_quota = user_service.used_quota(user_obs_config.service_type, today)
soft_limit = user_obs_config.soft_limit
provider = user_obs_config.provider
ret += [[service, monthly_quota, used_quota, soft_limit, provider]]
return ret
$$ LANGUAGE @@plpythonu@@ STABLE PARALLEL RESTRICTED;