fix(git-integration): deprecate multiprocessing and improve performance/resources usage in commits processing#3513
Merged
Merged
Conversation
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 pull request refactors the
CommitServiceclass in thegit_integrationapp to improve maintainability, efficiency, and consistency. The main changes include converting many static methods to instance methods, removing process pool logic, switching JSON serialization to useorjson, and updating the commit processing pipeline to be fully asynchronous and write directly to the database and Kafka.Refactoring and code modernization:
Converted most static methods in
CommitServiceto instance methods for improved encapsulation and easier testing. This includes methods likeis_valid_commit_hash,is_valid_datetime,should_skip_commit,clean_up_username,create_activity,extract_activities,prepare_activity_for_db_and_queue, andcreate_activities_from_commit. All internal references now useselfinstead of the class name. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]Removed all process pool management logic (
ProcessPoolExecutorand related methods), simplifying the class and focusing on async processing. [1] [2]Performance and serialization improvements:
jsonlibrary withorjsonfor faster serialization/deserialization, and updated all relevant code paths to useorjson.dumps(...).decode(). [1] [2] [3]Commit processing pipeline updates:
Refactored
process_commits_chunkto be anasyncmethod that processes commits and writes results directly to the database and Kafka, instead of returning them for later processing. This change enables better resource usage and aligns with the async design of the service. [1] [2] [3]Improved logging and error handling by using the instance logger throughout the class. [1] [2]
Dependency updates:
orjsonto thepyproject.tomldependencies to support the new serialization approach.