-
Notifications
You must be signed in to change notification settings - Fork 218
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/78040 135788 resume suspended bulk export job #8963
Feat/78040 135788 resume suspended bulk export job #8963
Conversation
|
apps/app/src/features/page-bulk-export/server/service/page-bulk-export.ts
Show resolved
Hide resolved
apps/app/src/features/page-bulk-export/server/service/page-bulk-export.ts
Outdated
Show resolved
Hide resolved
) { | ||
const activity = await this.crowi.activityService.createActivity({ | ||
...activityParameters, |
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.
ここをどうするか迷ったのですが、再開する時は apps/app/src/crowi/index.js
から実行されるため、activityParameters (ip と endpoint) を渡すことができません。
最初のクライアントからの bulk export 実行のリクエスト時に、ip と endpoint をどこかに保存しておいて、createActivity 時に渡すべきでしょうか?
正直 ip と endpoint の用途があまりわかっていませんが、ログ的な役割だと思っています。
裏で走っている非同期プロセス上でアプリが activity を行い、クライアントが直接 activity を行ったわけではない、という風に捉えれば、ip と endpoint は入れなくても良いのかなと思ったりしています (今はそのように実装しています)。
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.
action のタイプを、ユーザーが export をトリガーしたときとシステムが再開をトリガーしたときで分けちゃえばいいんじゃないかな。ユーザーがトリガーした時はやはり ip 欲しいので。
逆にシステムによるトリガーはログとしての activity はそんなに重要ではない
InAppNotification の方に影響がないならば記録しなくてもいい
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.
activityParameters を optional にし、API 経由で直接実行された時だけ渡すようにしましたm(_ _)m
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.
逆にシステムによるトリガーはログとしての activity はそんなに重要ではない
InAppNotification の方に影響がないならば記録しなくてもいい
InAppNotification に影響はないため、システムからのトリガーでは渡さなくて問題ありません。
…spended-bulk-export-job
…spended-bulk-export-job
…spended-bulk-export-job
}); | ||
if (duplicatePageBulkExportJobInProgress != null) { | ||
throw new DuplicateBulkExportJobError(); | ||
} |
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.
同じページに対して、進行中のエクスポートジョブがある場合はエラーを投げる。
throw new DuplicateBulkExportJobError(); | ||
} | ||
const pageBulkExportJob: PageBulkExportJobDocument & HasObjectId = await PageBulkExportJob.create({ | ||
user: currentUser, page: basePage, format, status: PageBulkExportJobStatus.initializing, |
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.
エクスポートの実行を追うための PageBulkExportJob を作成
], | ||
}); | ||
Promise.all(jobs.map(job => pageBulkExportService.executePageBulkExportJob(job))); | ||
}; |
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.
起動時に進行中の PageBulkExportJob を再開
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.
ペンディング中の job 数は予測ができない。
多すぎる場合に Promise.all ではリソースを食い潰すので、擬似的にでもキューイングのようなことをしたい。
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.
こちら
https://redmine.weseek.co.jp/issues/143599
で対応しようと思います。
TODO コメント残しておきました。
apps/app/src/features/page-bulk-export/server/service/page-bulk-export.ts
Show resolved
Hide resolved
apps/app/src/features/page-bulk-export/server/service/page-bulk-export.ts
Show resolved
Hide resolved
apps/app/src/features/page-bulk-export/server/service/page-bulk-export.ts
Outdated
Show resolved
Hide resolved
) { | ||
const activity = await this.crowi.activityService.createActivity({ | ||
...activityParameters, |
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.
action のタイプを、ユーザーが export をトリガーしたときとシステムが再開をトリガーしたときで分けちゃえばいいんじゃないかな。ユーザーがトリガーした時はやはり ip 欲しいので。
逆にシステムによるトリガーはログとしての activity はそんなに重要ではない
InAppNotification の方に影響がないならば記録しなくてもいい
], | ||
}); | ||
Promise.all(jobs.map(job => pageBulkExportService.executePageBulkExportJob(job))); | ||
}; |
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.
ペンディング中の job 数は予測ができない。
多すぎる場合に Promise.all ではリソースを食い潰すので、擬似的にでもキューイングのようなことをしたい。
実装内容
task
https://redmine.weseek.co.jp/issues/135788