Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CleanupDeletedTopologyComponents = &job.Job{ Name: "CleanupComponents", Schedule: "@every 1h", Singleton: true, JobHistory: true, Retention: job.RetentionDay, Fn: func(ctx job.JobRuntime) error { var rows []struct { ID string } if err := ctx.DB().Raw(` SELECT DISTINCT(topologies.id) FROM topologies INNER JOIN components ON topologies.id = components.topology_id WHERE components.deleted_at IS NULL AND topologies.deleted_at IS NOT NULL `).Scan(&rows).Error; err != nil { return err } for _, r := range rows { if err := db.DeleteComponentsOfTopology(ctx.DB(), r.ID); err != nil { ctx.History.AddError(fmt.Sprintf("Error deleting components for topology[%s]: %v", r.ID, err)) } else { ctx.History.IncrSuccess() } DeleteTopologyJob(r.ID) } return nil }, }
View Source
var SyncTopology = &job.Job{ Name: "SyncTopology", Schedule: "@every 5m", JobHistory: true, Singleton: true, RunNow: true, Fn: func(ctx job.JobRuntime) error { var topologies []pkg.Topology if err := ctx.DB().Table("topologies").Where(duty.LocalFilter). Find(&topologies).Error; err != nil { return err } for _, topology := range topologies { if err := SyncTopologyJob(ctx.Context, topology); err != nil { ctx.History.AddError(err.Error()) } else { ctx.History.IncrSuccess() } } return nil }, }
View Source
var TopologyScheduler = cron.New()
Functions ¶
func DeleteTopologyJob ¶
func DeleteTopologyJob(id string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.