Repository navigation
RHINENG-32308: sync template advisories from the message #2373
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
Changes from all commits
3eb5aad
680a100
8009f19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,10 +151,16 @@ func TemplateUpdate(ctx context.Context, template mqueue.TemplateResponse, event | |
| return errors.Wrap(err, "creating/updating template from message") | ||
| } | ||
|
|
||
| if contentSourcesBaseURL != "" && utils.CoreCfg.ContentSourcesUser != "" && eventType == TemplateEventUpdate { | ||
| ctx := identity.WithIdentity(base.Context, | ||
| switch { | ||
| case templatesWithAdvisories: | ||
| err = applyTemplateAdvisories(ctx, accountID, row.ID, template.UUID, template.OrgID, template.AdvisoryIDs) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High · Failed advisory sync stays stale When an advisory lookup or database write fails during a message-based sync, Propagate the per-template error from Also at Prompt for AI agentsIn `listener/templates.go` at line 156:
**Failed advisory sync stays stale**
When an advisory lookup or database write fails during a message-based sync, `TemplateUpdate` returns the error, but `TemplatesMessageHandler` only logs it and returns nil, so `MakeRetryingHandler` acknowledges the message and the stored advisory state remains stale or partial.
Propagate the per-template error from `TemplatesMessageHandler` so the retry handler can retry the message.
Also at `listener/templates.go:157-158`.There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High · Older snapshots overwrite newer advisories When an older template event is processed after a newer event, Compare the event time or revision with the latest processed value and ignore stale snapshots. Also at Prompt for AI agentsIn `listener/templates.go` at line 156:
**Older snapshots overwrite newer advisories**
When an older template event is processed after a newer event, `TemplateUpdate` applies each message's `AdvisoryIDs` as the full snapshot without comparing event times or revisions, so `applyTemplateAdvisories` replaces the newer advisory set with stale rows.
Compare the event time or revision with the latest processed value and ignore stale snapshots.
Also at `listener/templates.go:157`. |
||
| if err != nil { | ||
| return errors.Wrap(err, "syncing template advisories from message") | ||
| } | ||
| case contentSourcesBaseURL != "" && utils.CoreCfg.ContentSourcesUser != "" && eventType == TemplateEventUpdate: | ||
| csCtx := identity.WithIdentity(base.Context, | ||
| utils.XRHIDForOrg(template.OrgID, utils.CoreCfg.ContentSourcesUser)) | ||
| err = syncTemplateAdvisories(ctx, accountID, row.ID, template.UUID, template.OrgID) | ||
| err = syncTemplateAdvisories(csCtx, accountID, row.ID, template.UUID, template.OrgID) | ||
| if err != nil { | ||
| return errors.Wrap(err, "syncing template advisories") | ||
| } | ||
|
|
||
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.
🟠 High · Concurrent snapshots mix advisory rows
When two handlers process different snapshots for the same template concurrently,
applyTemplateAdvisoriesreads and diffs the stored rows before opening its transaction, so both handlers can apply additions based on the same old set and leave rows from both snapshots; callers see an advisory set matching neither snapshot.Serialize updates per template and read and diff the stored rows within that serialized transaction.
Prompt for AI agents