Conversation
mogery
approved these changes
Feb 26, 2025
Summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new batch billing system to streamline and optimize billing operations. Instead of processing each billing operation individually, the system aggregates them into batches for improved efficiency and reduced system load.
Key Changes
Batch Billing Implementation
batch_billing.tsfile has been added to handle all batch billing operations.team_id,subscription_id, andis_extract.setInterval) periodically checks the Redis queue and triggers batch processing.Queue and Job Management
process-batch) or individual billing operations (bill_team), which are then queued for batch processing.addBillingBatchJobandtriggerImmediateBillingProcessare introduced to ensure timely processing of billing operations.Worker Integration
Deprecation of Direct Billing
supaBillTeam:credit_billing.tsis deprecated.Additional Enhancements
Benefits
Batching reduces the overhead of processing many individual billing operations.
The locking mechanism prevents race conditions by ensuring single-batch processing.
The system is better equipped to handle high volumes of billing operations by grouping them together.