mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Ensure maintained apps are pulled immediately on next server start after FMAv2/WinFMA upgrade (#27589)
For #27582. # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] If database migrations are included, checked table schema to confirm autoupdate - For database migrations: - [x] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [x] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects. - [x] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). - [x] Manual QA for all new/changed functionality - [x] For unreleased bug fixes in a release candidate, confirmed that the fix is not expected to adversely impact load test results or alerted the release DRI if additional load testing is needed.
This commit is contained in:
parent
748b5bcd51
commit
b1fd576731
1 changed files with 8 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"github.com/fleetdm/fleet/v4/server/fleet"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
|
|
@ -109,6 +110,13 @@ ALTER TABLE fleet_maintained_apps
|
|||
return fmt.Errorf("failed to rename Zoom FMA: %w", err)
|
||||
}
|
||||
|
||||
// Clear out scheduled runs for the maintained_apps cron. This will force the cron to run on
|
||||
// next server start and sync the full maintained apps list, including Windows titles.
|
||||
_, err = tx.Exec(`DELETE FROM cron_stats WHERE name = ? AND stats_type = ?`, fleet.CronMaintainedApps, fleet.CronStatsTypeScheduled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to clear past scheduled runs of maintained_apps from cron_stats table: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue