✨ Add scheduled automatic plugin updates#218
Conversation
Add cron-based scheduled auto-update with dry-run mode and startup check.
🚀 Preview of mpmThis preview file are availalble for 7 days. (until 2026-03-17)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35a4b38e38
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (updatableInfos.isEmpty()) { | ||
| plugin.logger.info("[Scheduled/Dry-run] All plugins are up to date.") | ||
| } else { |
There was a problem hiding this comment.
Avoid claiming plugins are up to date in dry-run
In scheduled dry-run mode, this branch logs All plugins are up to date whenever updatableInfos is empty, even if there are outdated plugins in lockedInfos or unknownInfos. This produces contradictory output ("up to date" plus "skipped/failed" entries) and can mislead operators into thinking no action is needed when updates are actually pending but blocked. Use the same condition as startup check (all three lists empty) before emitting the "up to date" message.
Useful? React with 👍 / 👎.
Check locked and unknown lists alongside updatable before claiming all plugins are up to date in scheduled dry-run mode.
🚀 Preview of mpmThis preview file are availalble for 7 days. (until 2026-03-17)
|
🚀 Preview of mpmThis preview file are availalble for 7 days. (until 2026-03-17)
|
Summary
Closes #173
/mpm update --dry-runコマンドを追加(更新チェックのみ、実行なし)主な変更点
新規ファイル
ScheduleConfig.kt- スケジュール設定データクラス(enabled, cron, checkOnStartup, dryRun)UpdateScheduler.kt- スケジューラーインターフェース(start/stop/restart)UpdateSchedulerImpl.kt- cron-utilsを使ったスケジューラー実装変更ファイル
GlobalSettings.kt-schedule: ScheduleConfigフィールド追加MpmError.kt-UpdateInProgressエラー追加(並行更新防止)PluginUpdateServiceImpl.kt-Mutexによる並行更新防止UpdateCommand.kt---dry-runスイッチ追加、ロック状態フィルタReloadCommand.kt- reload時にスケジューラーを再起動Mpm.kt- Koin登録 + onEnable/onDisableでスケジューラー起動/停止設定例
{ "settings": { "schedule": { "enabled": true, "cron": "0 4 * * *", "checkOnStartup": true, "dryRun": false } } }安全性
nextExecution()で次回実行時刻を正確に計算(ポーリング方式ではない)AtomicLongによる世代管理で restart 時の旧タスク混入を防止Mutexによる全更新操作の排他制御(スケジューラー/コマンドの競合回避)Test plan
schedule.enabled: trueでサーバー起動 → 起動時チェックが動作することdryRun: trueで更新チェックのみ行われること/mpm update --dry-runで更新プレビューが表示されること/mpm reloadでスケジュール設定が即座に反映されること