chore: stability pr for changes (#35911)

## Description
- Changes to put blocking calls on the bounded elastic thread.
- This Pr has changes to test.
- commit
- Status
- branch
- delete branch
- List branch 
- checkout
- checkout remote
- merge status
- merge

Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`

## Automation

/ok-to-test tags="@tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]  
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.

<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved performance and responsiveness when saving applications to
Git repositories by optimizing the execution flow.
- Enhanced clarity and control in the application push process to Git,
ensuring better maintainability.

- **Bug Fixes**
- Addressed potential threading issues by ensuring operations run on the
appropriate scheduler.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Manish Kumar 2024-08-30 12:59:15 +05:30 committed by GitHub
parent abce472fdf
commit 4b89c1c7a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View File

@ -224,10 +224,8 @@ public class GitExecutorCEImpl implements GitExecutor {
// open the repo
Path baseRepoPath = createRepoPath(repoSuffix);
return gitConfig
.getIsAtomicPushAllowed()
.flatMap(isAtomicPushAllowed -> {
return Mono.using(
return gitConfig.getIsAtomicPushAllowed().flatMap(isAtomicPushAllowed -> {
return Mono.using(
() -> Git.open(baseRepoPath.toFile()),
git -> Mono.fromCallable(() -> {
log.debug(Thread.currentThread().getName() + ": pushing changes to remote "
@ -265,9 +263,12 @@ public class GitExecutorCEImpl implements GitExecutor {
.timeout(Duration.ofMillis(Constraint.TIMEOUT_MILLIS))
.name(GitSpan.FS_PUSH)
.tap(Micrometer.observation(observationRegistry)),
Git::close);
})
.subscribeOn(scheduler);
Git::close)
// this subscribeOn on is required because Mono.using
// is not deferring the execution of push and for that reason it runs on the
// lettuce-nioEventLoop thread instead of boundedElastic
.subscribeOn(scheduler);
});
}
/** Clone the repo to the file path : container-volume/orgId/defaultAppId/repo/<Data>

View File

@ -34,6 +34,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Component;
import reactor.core.Exceptions;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;
import java.io.IOException;
import java.nio.file.Path;
@ -93,7 +94,9 @@ public class CommonGitFileUtilsCE {
// Save application to git repo
try {
return fileUtils.saveApplicationToGitRepo(baseRepoSuffix, artifactGitReference, branchName);
return fileUtils
.saveApplicationToGitRepo(baseRepoSuffix, artifactGitReference, branchName)
.subscribeOn(Schedulers.boundedElastic());
} catch (IOException | GitAPIException e) {
log.error("Error occurred while saving files to local git repo: ", e);
throw Exceptions.propagate(e);