QA: Count QA execution minutes separately for now (#2011)
For now, keep QA exec time separate, as it may be scaled differently and currently still in beta.
This commit is contained in:
parent
4ec7cf8adc
commit
12f994b864
@ -774,15 +774,19 @@ class OrgOps:
|
|||||||
If is_qa is true, also update seperate qa only counter
|
If is_qa is true, also update seperate qa only counter
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-return-statements, too-many-locals
|
# pylint: disable=too-many-return-statements, too-many-locals
|
||||||
key = "crawlExecSeconds" if is_exec_time else "usage"
|
|
||||||
yymm = dt_now().strftime("%Y-%m")
|
yymm = dt_now().strftime("%Y-%m")
|
||||||
inc_query = {f"{key}.{yymm}": duration}
|
inc_query = {}
|
||||||
if is_qa:
|
|
||||||
|
if not is_qa:
|
||||||
|
key = "crawlExecSeconds" if is_exec_time else "usage"
|
||||||
|
inc_query[f"{key}.{yymm}"] = duration
|
||||||
|
else:
|
||||||
qa_key = "qaCrawlExecSeconds" if is_exec_time else "qaUsage"
|
qa_key = "qaCrawlExecSeconds" if is_exec_time else "qaUsage"
|
||||||
inc_query[f"{qa_key}.{yymm}"] = duration
|
inc_query[f"{qa_key}.{yymm}"] = duration
|
||||||
|
|
||||||
await self.orgs.find_one_and_update({"_id": oid}, {"$inc": inc_query})
|
await self.orgs.find_one_and_update({"_id": oid}, {"$inc": inc_query})
|
||||||
|
|
||||||
if not is_exec_time:
|
if not is_exec_time or is_qa:
|
||||||
return
|
return
|
||||||
|
|
||||||
org = await self.get_org_by_id(oid)
|
org = await self.get_org_by_id(oid)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user