fix: move event publish inside retry loop
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 38s
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 38s
This commit is contained in:
parent
e7cbe6da26
commit
d3ec1d52d6
@ -63,9 +63,7 @@ export class AiGatewayService {
|
|||||||
output.usage.outputTokens,
|
output.usage.outputTokens,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.eventBus?.publish(new (class extends BaseDomainEvent { eventType = 'ai.usage.recorded'; data: any; constructor(d: any) { super(); this.data = d; } })({ userId: request.userId, provider: target.provider, model: target.model, tier: request.tier, inputTokens: output.usage.inputTokens, outputTokens: output.usage.outputTokens, estimatedCost, latencyMs: output.latencyMs }));
|
this.usageLog.log({
|
||||||
|
|
||||||
this.usageLog.log({
|
|
||||||
userId: request.userId,
|
userId: request.userId,
|
||||||
feature: request.feature,
|
feature: request.feature,
|
||||||
provider: target.provider,
|
provider: target.provider,
|
||||||
@ -101,8 +99,6 @@ export class AiGatewayService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eventBus?.publish(new (class extends BaseDomainEvent { eventType = 'ai.usage.recorded'; data: any; constructor(d: any) { super(); this.data = d; } })({ userId: request.userId, provider: target.provider, model: target.model, tier: request.tier, inputTokens: output.usage.inputTokens, outputTokens: output.usage.outputTokens, estimatedCost, latencyMs: output.latencyMs }));
|
|
||||||
|
|
||||||
this.usageLog.log({
|
this.usageLog.log({
|
||||||
userId: request.userId,
|
userId: request.userId,
|
||||||
feature: request.feature,
|
feature: request.feature,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user