buggix
This commit is contained in:
parent
7b7d859be1
commit
b3060eee9d
@ -47,10 +47,11 @@ async def checkCustomerBalance(llmid, userid, userorgid, catelogid=None):
|
|||||||
return True
|
return True
|
||||||
balance = 0.00
|
balance = 0.00
|
||||||
tpac = await get_user_tpac(userid)
|
tpac = await get_user_tpac(userid)
|
||||||
debug(f'{tpac=}')
|
|
||||||
if tpac:
|
if tpac:
|
||||||
|
debug(f'{tpac=}, get tpac balance')
|
||||||
balance = await get_tpac_balance(tpac, userid)
|
balance = await get_tpac_balance(tpac, userid)
|
||||||
else:
|
else:
|
||||||
|
debug(f'{tpac=}, get local balance')
|
||||||
async with get_sor_context(env, 'accounting') as sor:
|
async with get_sor_context(env, 'accounting') as sor:
|
||||||
balance = await getCustomerBalance(sor, userorgid)
|
balance = await getCustomerBalance(sor, userorgid)
|
||||||
bal = 0 if balance is None else balance
|
bal = 0 if balance is None else balance
|
||||||
@ -228,12 +229,12 @@ async def backend_accounting():
|
|||||||
# debug(f'{len(lus)=} need to accounting........')
|
# debug(f'{len(lus)=} need to accounting........')
|
||||||
for lu in lus:
|
for lu in lus:
|
||||||
try:
|
try:
|
||||||
debug(f'backend_accounting(): {lu.id=} handleing...')
|
|
||||||
tpac = await get_user_tpac(lu.userid)
|
tpac = await get_user_tpac(lu.userid)
|
||||||
debug(f'{lu.userid=}, {tpac=}')
|
|
||||||
if tpac:
|
if tpac:
|
||||||
|
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go tpac')
|
||||||
await tpac_accounting(tpac, lu.userid, lu.llmid, lu.amount, lu.usages, lu.id)
|
await tpac_accounting(tpac, lu.userid, lu.llmid, lu.amount, lu.usages, lu.id)
|
||||||
else:
|
else:
|
||||||
|
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local')
|
||||||
await llm_accounting(lu)
|
await llm_accounting(lu)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}, {lu.id=}')
|
exception(f'{e}, {lu.id=}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user