chore: add SafeGoroutine

This commit is contained in:
CaIon
2024-01-12 13:49:53 +08:00
parent 075b1ac113
commit febcadb42c
2 changed files with 19 additions and 1 deletions

View File

@@ -80,7 +80,9 @@ func RecordConsumeLog(ctx context.Context, userId int, channelId int, promptToke
common.LogError(ctx, "failed to record log: "+err.Error())
}
if common.DataExportEnabled {
go LogQuotaData(userId, username, modelName, quota, common.GetTimestamp())
common.SafeGoroutine(func() {
LogQuotaData(userId, username, modelName, quota, common.GetTimestamp())
})
}
}