Skip to content
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

Feat/78039 151411 cancel streams on export job abort #8997

Conversation

arafubeatbox
Copy link
Contributor

@arafubeatbox arafubeatbox commented Jul 28, 2024

やったこと

  • export job を実行するために作られた stream を管理する class (PageBulkExportJobStreamManager) を実装
    • 実行中の stream を登録し、cleanup の際に stream を破棄する

task

https://redmine.weseek.co.jp/issues/151411

Copy link

changeset-bot bot commented Jul 28, 2024

⚠️ No Changeset found

Latest commit: 8c5ec2e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

…obs' into feat/78039-151411-cancel-streams-on-export-job-abort
…obs' into feat/78039-151411-cancel-streams-on-export-job-abort
…obs' into feat/78039-151411-cancel-streams-on-export-job-abort
…obs' into feat/78039-151411-cancel-streams-on-export-job-abort
…obs' into feat/78039-151411-cancel-streams-on-export-job-abort
Base automatically changed from feat/78039-135789-delete-unnecessary-page-bulk-export-jobs to feat/page-bulk-export August 26, 2024 06:23
@arafubeatbox arafubeatbox marked this pull request as ready for review August 26, 2024 08:01
@@ -377,6 +383,8 @@ class PageBulkExportService {
* - abort multipart upload
*/
async cleanUpExportJobResources(pageBulkExportJob: PageBulkExportJobDocument) {
this.pageBulkExportJobStreamManager?.destroyJobStream(pageBulkExportJob._id);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

job を cleanUp する際、実行中の stream があればそれを停止させる (実行中の stream が無くてもエラーにはならない

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageBulkExportJobStreamManager?? 不要では?

private jobStreams: Record<string, Readable> = {};

addJobStream(jobId: ObjectIdLike, stream: Readable): void {
this.jobStreams[jobId.toString()] = stream;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add 時に既に同 ID の stream が存在していたら destroy すべきではないかな

@@ -377,6 +383,8 @@ class PageBulkExportService {
* - abort multipart upload
*/
async cleanUpExportJobResources(pageBulkExportJob: PageBulkExportJobDocument) {
this.pageBulkExportJobStreamManager?.destroyJobStream(pageBulkExportJob._id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageBulkExportJobStreamManager?? 不要では?

@arafubeatbox arafubeatbox merged commit 1c39b00 into feat/page-bulk-export Aug 26, 2024
5 checks passed
@arafubeatbox arafubeatbox deleted the feat/78039-151411-cancel-streams-on-export-job-abort branch August 26, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants