-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Efficient Repository Updates instead of Refetching #103
Conversation
...server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentConverter.java
Show resolved
Hide resolved
...ver/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestConverter.java
Show resolved
Hide resolved
...pplication-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserConverter.java
Outdated
Show resolved
Hide resolved
...server/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/IssueCommentConverter.java
Outdated
Show resolved
Hide resolved
...erver/src/main/java/de/tum/in/www1/hephaestus/codereview/repository/RepositoryConverter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can simplify the sync service a bit. coplit suggested the following:
To simplify the GitHubDataSyncService class, we can break down its responsibilities into smaller, more manageable methods and classes. This will make the code more modular and easier to maintain. Here are some steps to achieve this:
Extract GitHub Initialization: Move the GitHub client initialization to a separate method.
Extract Repository Synchronization: Move the repository synchronization logic to a separate method.
Extract Pull Request Handling: Move the pull request handling logic to a separate method.
Extract Review Handling: Move the review handling logic to a separate method.
Extract Comment Handling: Move the comment handling logic to a separate method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really liked the suggestion for the Github client init (done in ce3b04a). The other ones are already kinda separated in the suggested manner.
My main point of improvement would be finding a cleaner way of implementing the "get entity from Cache/DB/Create New"-methods. Ideally, this should be externalized using some abstract generalization (for example in the entities) or directly moved to a dedicated service. I wasn't able to find an appropriate solution yet though.
Code LGTM, thank you! |
Motivation
With our CRON-job, we want to make updating the repository and all its elements like PullRequests, Reviews and Comments as efficient as possible. This entails only fetching updated elements and updating entities instead of having to recreate them.
Description
This PR modifies the Github sync algorithm to allow for efficient refetching and updates:
cutOffDate
to determine how many PRs have to be refetchedupdate
-function of their respective convertersREFRESH
instead ofMERGE
Remark
The
GitHubDataSyncService
may get overly complex at some point. I would appreciate any suggestions on how to improve its structure or separate the logic into multiple classes,Checklist
General
Server