Skip to content

feat(LLMO-5003): enqueue async domain-wide covered marking after edge…#2484

Open
khushboo5723 wants to merge 1 commit into
mainfrom
feat/LLMO-5003-async-covered-marking
Open

feat(LLMO-5003): enqueue async domain-wide covered marking after edge…#2484
khushboo5723 wants to merge 1 commit into
mainfrom
feat/LLMO-5003-async-covered-marking

Conversation

@khushboo5723
Copy link
Copy Markdown
Contributor

Summary

  • After a domain-wide suggestion is successfully deployed, enqueues a domain-wide-covered-marking
    job to the import worker SQS queue
  • Adds DOMAIN_WIDE_COVERED_MARKING_TYPE constant to edge-routing-utils.js (same pattern as
    OPTIMIZE_AT_EDGE_ENABLED_MARKING_TYPE)
  • The sync Promise.all in deployToEdge times out at 2-3k+ suggestions; the import worker job
    guarantees marking happens regardless

Context

The edge-deploy API was synchronously making N parallel Postgres saves (one per URL-level suggestion)
to mark coveredByDomainWide. At 2-3k+ suggestions this exceeds connection limits and fails silently.
This change delegates the marking to the import worker asynchronously.

Part of LLMO-5003. The import worker handler (domain-wide-covered-marking) is in a separate PR in
spacecat-import-worker. The UI changes (30s hide-suggestions state) are in a separate PR in
project-elmo-ui.

Test plan

  • New tests: enqueues domain-wide-covered-marking job after successful domain-wide deploy
  • New tests: logs warning but still returns 207 when domain-wide-covered-marking SQS enqueue fails
  • npm test passes

… deploy

After a domain-wide suggestion is successfully deployed, enqueue a
domain-wide-covered-marking job to the import worker instead of relying
on the synchronous Promise.all in deployToEdge, which times out at
2-3k+ suggestions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

await context.sqs.sendMessage(
context.env.IMPORT_WORKER_QUEUE_URL,
{
type: DOMAIN_WIDE_COVERED_MARKING_TYPE,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls keep the name as PATTERN_COVERED_MARKING_TYPE to keep it generic enough to cover the segment use case also in future.

type: DOMAIN_WIDE_COVERED_MARKING_TYPE,
siteId,
opportunityId,
domainWideSuggestionIds: succeededDomainWideIds,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patternBasedSuggestionIds

// Import worker job type for async domain-wide covered marking.
// Enqueued after a domain-wide edge deploy so the import worker marks all matching
// URL-level suggestions as coveredByDomainWide without blocking the API response.
export const DOMAIN_WIDE_COVERED_MARKING_TYPE = 'domain-wide-covered-marking';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pattern-based-covered-marking

Copy link
Copy Markdown
Contributor

@nit23uec nit23uec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be aligned to a generic pattern based terminology rather than being coupled with domain wide (which is a special case of pattern)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants