Skip to content

WIP: watcher: add optional SQS subscription for crate index changes - #3349

Draft
syphar wants to merge 79 commits into
rust-lang:mainfrom
syphar:crates-io-sqs
Draft

WIP: watcher: add optional SQS subscription for crate index changes#3349
syphar wants to merge 79 commits into
rust-lang:mainfrom
syphar:crates-io-sqs

Conversation

@syphar

@syphar syphar commented May 22, 2026

Copy link
Copy Markdown
Member

idea is:

  • infra has to provide the SQS FIFO queue, permissions for docs.rs, and credentials for crates.io
  • merge & release add docs_rs_crates_io subcrate for interaction / shared types #3357 , so crates.io can use the structs to start publishing the events
  • when we can finish up this PR, first let the SQS consumption just run in parallel (dry-run / log) to git index
  • if no errors / all fine, switch over to sqs

@syphar syphar self-assigned this May 22, 2026
@github-actions github-actions Bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label May 22, 2026
@syphar syphar changed the title watcher: add sqs sdk, add first draft for event payload structs WIP: watcher: add sqs sdk, add first draft for event payload structs May 22, 2026
syphar added 7 commits May 22, 2026 17:32
Wrap typed change payloads in a conventional event envelope with id, occurred_at, source, and schema_version.
Rename the current wire payload to ChangeV1 and make the event envelope generic for future schema versions.
Remove event source metadata and store occurred_at as an RFC 3339 OffsetDateTime.
Replace time::OffsetDateTime with chrono::DateTime<Utc> for RFC 3339 event timestamps.
syphar added 8 commits May 22, 2026 18:33
Treat duplicate version deletion events as a no-op so temporary event-based handling can safely replay them.
Add watcher config fields for an SQS queue URL and region to support an event-based path.
Use url::Url for the watcher SQS queue URL config so invalid values fail during config loading.
Update Cargo.lock after making docs_rs_watcher depend directly on url.
Remove the redundant schema_version field from the crates.io event envelope and keep versioning in the typed payloads.
@rustbot

This comment has been minimized.

Comment thread crates/lib/docs_rs_crates_io/src/events.rs
syphar added 28 commits July 2, 2026 01:12
Rename the SQS subscriber entrypoints to better reflect the transport, body-handling, and event-processing layers.
Supervise the SQS subscriber separately in mixed mode so SQS failures are logged and restarted without stopping the legacy registry watcher.
Add starter counters and histograms for SQS intake, failures, retries, processing time, event lag, and applied change types, and record them from the subscriber flow.
Add buckets around the one-minute visibility timeout so slow message handlers are easier to spot in metrics.
.add(messages.len() as u64, &[]);

for message in messages {
match handle_message_body(context, config, metrics, message.body.as_deref()).await {

@syphar syphar Jul 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

can we have some graceful shutdown here?

otherwise, if the watcher is stopped while handling a message, the msg will be in-flight in SQS, so sqs will wait delivering any message for the visibility timeout.

View changes since the review

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

Labels

S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants