-
Notifications
You must be signed in to change notification settings - Fork 0
🔀 :: [#819] - 애플리케이션 비동기 작업에도 락이 적용되도록 수정 #820
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
4 commits
Select commit
Hold shift + click to select a range
23dbe6e
[feat] 애플리케이션 컨테이너 재생성 로직을 서비스로 추가
dolong2 6e239cf
[refac] 애플리케이션 컨테이너 생성 로직을 RefreshApplicationService로 리펙토링
dolong2 7fdb8cd
[feat] RefreshApplicationService 구현체에 Lock 적용
dolong2 a1ae48c
[refac] 애플리케이션 수정시 컨테이너 재생성이 필요하다면 PENDING 상태로 코루틴 진입전에 변경하도록 수정
dolong2 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
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
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/dcd/server/core/domain/application/service/RefreshApplicationService.kt
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,7 @@ | ||
| package com.dcd.server.core.domain.application.service | ||
|
|
||
| import com.dcd.server.core.domain.application.model.Application | ||
|
|
||
| interface RefreshApplicationService { | ||
| suspend fun refresh(application: Application) | ||
| } |
42 changes: 42 additions & 0 deletions
42
...tlin/com/dcd/server/core/domain/application/service/impl/RefreshApplicationServiceImpl.kt
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,42 @@ | ||
| package com.dcd.server.core.domain.application.service.impl | ||
|
|
||
| import com.dcd.server.core.common.annotation.Lock | ||
| import com.dcd.server.core.common.spi.ContainerPort | ||
| import com.dcd.server.core.domain.application.model.Application | ||
| import com.dcd.server.core.domain.application.model.enums.ApplicationType | ||
| import com.dcd.server.core.domain.application.spi.ApplicationImageFilePort | ||
| import com.dcd.server.core.domain.application.spi.ApplicationRemoteRepoPort | ||
| import com.dcd.server.core.domain.application.service.DeleteApplicationDirectoryService | ||
| import com.dcd.server.core.domain.application.service.RefreshApplicationService | ||
| import com.dcd.server.core.domain.volume.spi.QueryVolumePort | ||
| import org.springframework.stereotype.Service | ||
|
|
||
| @Service | ||
| class RefreshApplicationServiceImpl( | ||
| private val containerPort: ContainerPort, | ||
| private val applicationRemoteRepoPort: ApplicationRemoteRepoPort, | ||
| private val applicationImageFilePort: ApplicationImageFilePort, | ||
| private val deleteApplicationDirectoryService: DeleteApplicationDirectoryService, | ||
| private val queryVolumePort: QueryVolumePort | ||
| ) : RefreshApplicationService { | ||
| @Lock("#application.id", waitTime = 1000 * 10, leaseTime = 1000 * 60 * 3) | ||
| override suspend fun refresh(application: Application) { | ||
| val applicationType = application.applicationType | ||
| when(applicationType) { | ||
| ApplicationType.SPRING_BOOT, ApplicationType.NEST_JS, ApplicationType.GIN -> { | ||
| applicationRemoteRepoPort.cloneApplicationRemoteRepo(application) | ||
| } | ||
| else -> {} | ||
| } | ||
|
|
||
| applicationImageFilePort.createImageFile(application) | ||
|
|
||
| containerPort.execute { | ||
| buildImage(application) | ||
| val volumeMounts = queryVolumePort.findAllMountByApplication(application) | ||
| createContainer(application, volumeMounts) | ||
| } | ||
|
|
||
| deleteApplicationDirectoryService.deleteApplicationDirectory(application) | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.