Skip to content

refactor: batch paykit contact cleanup#638

Open
ben-kaufman wants to merge 2 commits into
codex/paykit-incoming-payment-requestsfrom
codex/batch-paykit-contact-cleanup
Open

refactor: batch paykit contact cleanup#638
ben-kaufman wants to merge 2 commits into
codex/paykit-incoming-payment-requestsfrom
codex/batch-paykit-contact-cleanup

Conversation

@ben-kaufman

Copy link
Copy Markdown
Contributor

Description

This PR builds on #637 to address the Paykit cleanup performance follow-ups from #620:

  • Reads the SDK linked-peer list once per multi-contact publication or cleanup pass instead of once per contact.
  • Clears receiver-scoped payment lists as before, then drains outbound private messages and checks pending status once for the whole successful batch.
  • Preserves per-contact failure isolation: contacts with failed or still-pending cleanup retain their cached state and retry marker, while successful contacts are cleared.

No user-facing behavior changes are intended.

Linked Issues/Tasks

Screenshot / Video

N/A — service-only refactor.

QA Notes

Manual Tests

N/A

Automated Checks

  • PrivatePaykitServiceTests.swift: all 10 focused tests passed in the iOS simulator.
  • SwiftFormat lint passed for the changed Swift file.
  • git diff --check passed.

@ben-kaufman
ben-kaufman marked this pull request as ready for review July 22, 2026 09:32
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR batches Paykit contact cleanup work to reduce repeated SDK calls. The main changes are:

  • Reads and groups linked peers once per publication or cleanup batch.
  • Drains outbound private messages once after clearing the batch.
  • Tracks cleanup success and cached-state removal per contact.

Confidence Score: 4/5

The batch-wide linked-peer failure path can leave stale endpoints without a cleanup retry.

  • Successful batch processing keeps failures isolated by contact.
  • A failed shared lookup suppresses cleanup updates and retry keys for every contact.
  • Non-immediate publication callers can discard that failure.

Bitkit/Services/PrivatePaykitService+Contacts.swift

Important Files Changed

Filename Overview
Bitkit/Services/PrivatePaykitService+Contacts.swift Batches linked-peer reads and message draining while preserving per-contact cleanup state, but the shared lookup failure path can omit cleanup and retries.

Reviews (1): Last reviewed commit: "refactor: batch paykit contact cleanup" | Re-trigger Greptile

Comment thread Bitkit/Services/PrivatePaykitService+Contacts.swift Outdated
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-incoming-payment-requests branch from ee9a95c to ae345b3 Compare July 22, 2026 13:01
@ben-kaufman
ben-kaufman force-pushed the codex/batch-paykit-contact-cleanup branch from be606b0 to 1b7bc5e Compare July 22, 2026 13:01
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-incoming-payment-requests branch from ae345b3 to 778f6d0 Compare July 22, 2026 14:09
@ben-kaufman
ben-kaufman force-pushed the codex/batch-paykit-contact-cleanup branch from 1b7bc5e to 4e8c5a4 Compare July 22, 2026 14:11
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-incoming-payment-requests branch from 778f6d0 to 9dcc431 Compare July 22, 2026 15:34
@ben-kaufman
ben-kaufman force-pushed the codex/batch-paykit-contact-cleanup branch from 4e8c5a4 to 0dd87ec Compare July 22, 2026 15:36
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.

1 participant