Repository navigation
Post each Hardcover quote once and space out Hardcover requests - #160
Conversation
Sync now and re-uploaded clippings queued quotes that Hardcover already had, and each push posts a new journal entry, so retries from the portal made copies. A clipping already delivered or queued with the same text and note is no longer queued again for Hardcover. Hardcover returns 429 after about 10 requests in a short burst, and one progress push makes several. Requests on one token now go out at most once a second. Fixes #158
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f813a540b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| `SELECT payload FROM connector_queue | ||
| WHERE user_id = ? AND connector_id = ? AND document = ? AND kind = ? AND status IN ('done', 'pending')` | ||
| ).get(userId, connectorId, document, kind) as { payload: string } | undefined; | ||
| if (!row) return false; | ||
| const prev = (JSON.parse(row.payload) as OutboundEvent).highlight; | ||
| return prev?.text === h?.text && (prev?.note ?? null) === (h?.note ?? null); |
There was a problem hiding this comment.
Scope delivered-quote deduplication to the remote destination
If a quote was delivered under an incorrect Hardcover book match, correcting that match and pressing “Sync now” now skips the quote permanently: this lookup treats the old book's done row as proof that the new book already has it. The manual-match route in src/routes/v1/connectors.ts calls saveMatch(), which updates connector_matches without invalidating queue rows, and neither the stored event nor this comparison records the destination book ID. Re-uploading the unchanged clipping is also suppressed. Track the destination associated with successful delivery, or invalidate the relevant delivery marker when the destination changes, so correcting a match can populate the correct book.
Useful? React with 👍 / 👎.
A quote delivered to the old book never reached the new one, so a new match clears its delivered clippings and Sync now sends them to it.
Before: pressing Sync now, or the reader uploading a clipping again, queued quotes that Hardcover already had. Each push creates a new journal entry, so every retry from the portal posted another copy. A drain also sent Hardcover many requests in a row, and it answered 429 after about 10.
After: a clipping that Hardcover already has, or that is already queued with the same text and note, is not queued again. An edited note still posts a new quote. Matching the book to a different Hardcover book lets its quotes go to the new book. Hardcover requests on one token go out at most once a second.
How: a new
highlightsAppendOnlyconnector flag, set only on Hardcover, makes fan-out and backfill skip a highlight row that is done or pending with the same text and note.saveMatch()clears delivered highlight rows when the matched book changes.gql()reserves a send slot per token, 1 s apart (HARDCOVER_MIN_GAP_MS, set to 0 invitest.config.ts). The new tests fail on the old code.Fixes #158