-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: additional test cases and method refactor to follow old standards #33734
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1e7f6a3
added changes
sondermanish d88c1c1
refactored interface name
sondermanish 69c4dc9
fixed test cases after adding fallback
sondermanish bb8e141
added test case to verify metadata retrieve operation
sondermanish 92f8f68
added reviewed changes
sondermanish 0ba7771
added changes
sondermanish 8287053
Merge remote-tracking branch 'origin/release' into chore/server-autoc…
sondermanish a940dc1
removed mono.defer
sondermanish 8ffede1
reverting changes
sondermanish f378b03
removed retry for the file lock
sondermanish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
app/server/appsmith-server/src/main/java/com/appsmith/server/git/GitRedisUtils.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package com.appsmith.server.git; | ||
|
|
||
| import com.appsmith.server.exceptions.AppsmithError; | ||
| import com.appsmith.server.exceptions.AppsmithException; | ||
| import com.appsmith.server.helpers.RedisUtils; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
| import reactor.core.publisher.Mono; | ||
| import reactor.util.retry.Retry; | ||
|
|
||
| import static com.appsmith.server.helpers.GitUtils.MAX_RETRIES; | ||
| import static com.appsmith.server.helpers.GitUtils.RETRY_DELAY; | ||
|
|
||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class GitRedisUtils { | ||
|
|
||
| private final RedisUtils redisUtils; | ||
|
|
||
| public Mono<Boolean> addFileLock(String defaultApplicationId) { | ||
| return redisUtils | ||
| .addFileLock(defaultApplicationId) | ||
| .retryWhen(Retry.fixedDelay(MAX_RETRIES, RETRY_DELAY) | ||
| .onRetryExhaustedThrow((retryBackoffSpec, retrySignal) -> { | ||
| throw new AppsmithException(AppsmithError.GIT_FILE_IN_USE); | ||
| })); | ||
| } | ||
|
|
||
| public Mono<Boolean> addFileLockWithoutRetry(String defaultApplicationId) { | ||
| return redisUtils.addFileLock(defaultApplicationId); | ||
| } | ||
|
|
||
| public Mono<Boolean> releaseFileLock(String defaultApplicationId) { | ||
| return redisUtils.releaseFileLock(defaultApplicationId); | ||
| } | ||
| } | ||
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
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
30 changes: 30 additions & 0 deletions
30
...va/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperFallbackImpl.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package com.appsmith.server.helpers.ce.autocommit; | ||
|
|
||
| import com.appsmith.server.domains.GitArtifactMetadata; | ||
| import com.appsmith.server.dtos.PageDTO; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.stereotype.Component; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| import static java.lang.Boolean.FALSE; | ||
|
|
||
| @Slf4j | ||
| @Component | ||
| public class AutoCommitEligibilityHelperFallbackImpl implements AutoCommitEligibilityHelper { | ||
|
|
||
| @Override | ||
| public Mono<Boolean> isServerAutoCommitRequired(String workspaceId, GitArtifactMetadata gitMetadata) { | ||
| return Mono.just(FALSE); | ||
| } | ||
|
|
||
| @Override | ||
| public Mono<Boolean> isClientMigrationRequired(PageDTO pageDTO) { | ||
| return Mono.just(FALSE); | ||
| } | ||
|
|
||
| @Override | ||
| public Mono<AutoCommitTriggerDTO> isAutoCommitRequired( | ||
| String workspaceId, GitArtifactMetadata gitArtifactMetadata, PageDTO pageDTO) { | ||
| return Mono.just(new AutoCommitTriggerDTO(FALSE, FALSE, FALSE)); | ||
| } | ||
| } |
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
4 changes: 4 additions & 0 deletions
4
...-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitTriggerDTO.java
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
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
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
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
Oops, something went wrong.
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.
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.
Approving the PR due to urgency, but please refactor this call to make retry a parameter instead of a separate method.