Skip to content

Commit

Permalink
fix: do not update parent & path if graph cannot be formed
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed May 14, 2024
1 parent 9760964 commit 268a0a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions db/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@ func extractConfigsAndChangesFromResults(ctx api.ScrapeContext, scrapeStartTime
if existing == nil || existing.ID == "" {
newConfigs = append(newConfigs, ci)
} else {
// In case, we are not able to derive the path & parent_id
// by forming a tree, we need to use the existing one
// otherwise they'll be updated to empty values
ci.ParentID = existing.ParentID
ci.Path = existing.Path

configsToUpdate = append(configsToUpdate, &updateConfigArgs{
Result: result,
Existing: existing,
Expand Down
1 change: 1 addition & 0 deletions scrapers/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func scheduleScraperJob(sc api.ScrapeContext) error {
Schedule: schedule,
Singleton: true,
JobHistory: true,
RunNow: true,
Retention: job.RetentionBalanced,
ResourceID: sc.ScrapeConfig().GetPersistedID().String(),
ResourceType: job.ResourceTypeScraper,
Expand Down

0 comments on commit 268a0a9

Please sign in to comment.