-
Notifications
You must be signed in to change notification settings - Fork 219
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: Automatic thread deletion using node-cron #9256
feat: Automatic thread deletion using node-cron #9256
Conversation
|
…5763-automatic-thread-deletion
…5763-automatic-thread-deletion
…5763-automatic-thread-deletion
this.openaiService = openaiService; | ||
|
||
// Executed at 0 minutes of every hour | ||
const cronSchedule = '0 * * * *'; |
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.
一時間に一回実行
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.
環境変数でカスタムできても良いかも
private async executeJob(): Promise<void> { | ||
// Must be careful of OpenAI's rate limit | ||
// Delete up to 100 threads per hour | ||
await this.openaiService.deleteExpiredThreads(DELETE_LIMIT); |
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.
- OpenAI の rate limit に考慮して最大100件まで thread を削除する
- いっきに何千件も削除してしまった場合、メインのナレッジアシスタントに影響が出てしまう可能性があるため
|
||
} | ||
|
||
export default ThreadDeletionCronService; |
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.
QuestionnaireCronService を参考にして実装しました。
https://github.com/weseek/growi/blob/df8e58f4486c03c1f7bad22b9645f468e315a915/apps/app/src/features/questionnaire/server/service/questionnaire-cron.ts
@mergify requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
cc279f4
into
feat/155690-implement-openai-thread-model
Task