-
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
Imprv/158220 158223 add page bulk export job cron #9461
Imprv/158220 158223 add page bulk export job cron #9461
Conversation
|
*/ | ||
getTmpOutputDir(pageBulkExportJob: PageBulkExportJobDocument): string { | ||
return `${this.tmpOutputRootDir}/${pageBulkExportJob._id}`; | ||
} |
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.
PageBulkExportService からの抽出
* @param action whether the export was successful | ||
* @param pageBulkExportJob the page bulk export job | ||
*/ | ||
async notifyExportResultAndCleanUp( |
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.
PageBulkExportService からの抽出
* - remove the temporal output directory | ||
* - abort multipart upload | ||
*/ | ||
async cleanUpExportJobResources(pageBulkExportJob: PageBulkExportJobDocument, restarted = false) { |
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.
PageBulkExportService からの抽出
}); | ||
} | ||
|
||
private async notifyExportResult( |
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.
PageBulkExportService からの抽出
import type { PageBulkExportJobDocument } from '../../../models/page-bulk-export-job'; | ||
|
||
const logger = loggerFactory('growi:service:page-bulk-export-job-cron:compress-and-upload-async'); | ||
|
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.
このファイル内の関数は全て PageBulkExportService からの抽出
import type { PageBulkExportJobDocument } from '../../../models/page-bulk-export-job'; | ||
import PageBulkExportJob from '../../../models/page-bulk-export-job'; | ||
import PageBulkExportPageSnapshot from '../../../models/page-bulk-export-page-snapshot'; | ||
|
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.
このファイル内の関数は全て PageBulkExportService からの抽出
import type { PageBulkExportJobDocument } from '../../../models/page-bulk-export-job'; | ||
import type { PageBulkExportPageSnapshotDocument } from '../../../models/page-bulk-export-page-snapshot'; | ||
import PageBulkExportPageSnapshot from '../../../models/page-bulk-export-page-snapshot'; | ||
|
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.
このファイル内の関数は全て PageBulkExportService からの抽出
* Manages cronjob which proceeds PageBulkExportJobs in progress. | ||
* If PageBulkExportJob finishes the current step, the next step will be started on the next cron execution. | ||
*/ | ||
class PageBulkExportJobCronService extends CronService implements IPageBulkExportJobCronService { |
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.
executeJob (cronjob の実行対象) で実行される proceedBulkExportJob がキモ。それ以外はほとんど PageBulkExportService からの抽出。
PageBulkExportJob が中断された際に実行中の stream も停止する必要があるため、streamInExecutionMemo を追加 (PageBulkExportService では PageBulkExportJobManager が担っていた)
*/ | ||
class PageBulkExportJobCronService extends CronService implements IPageBulkExportJobCronService { | ||
|
||
crowi: any; |
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.
Crowi 型を参照させてください
this.crowi = crowi; | ||
this.activityEvent = crowi.event('activity'); | ||
this.pageModel = mongoose.model<IPage, PageModel>('Page'); | ||
this.userModel = mongoose.model<IUser>('User'); |
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.
mongoose.model() によるモデルオブジェクト取得は、それを利用するメソッドの冒頭で実行してください
実装内容
task
https://redmine.weseek.co.jp/issues/158223