You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are implementing two specific sync enhancements requested by the user:
4
+
1.**Item 2: Guard Upload Selection on Failed Listings:** If a sync provider's listing fails, we must not falsely assume our local notes are missing from that provider (which would trigger unnecessary massive re-upload storms). We will track which provider listings failed and bypass the "missing" check for those failed providers.
5
+
2.**Item 3: S3 Bulk Delete:** S3 supports deleting up to 1,000 keys in a single batch request (`deleteObjects`). We will implement `deleteNotesFromS3Bulk` in `src/s3.js` and integrate it into `helpers.js:synchronize` to execute deletes in a single batched S3 request.
6
+
7
+
---
8
+
9
+
## 1. Step-by-Step Design for Item 2 (Guard Upload Selection on Failed Listings)
10
+
11
+
### 1.1 Update `listNotes()` in `src/helpers.js`
12
+
Modify `listNotes` to return `failedProviders` listing status:
13
+
- Return `failedProviders` object mapping each provider key to a boolean status indicating whether the listing failed.
14
+
- A provider is considered failed if its settled promise status is `'rejected'`.
15
+
16
+
```javascript
17
+
// Inside listNotes()
18
+
constfailedProviders= {
19
+
s3:s3Res.status==='rejected',
20
+
nostr:nostrRes.status==='rejected',
21
+
git:gitRes.status==='rejected',
22
+
gdrive:gdriveRes.status==='rejected',
23
+
ipfs:ipfsRes.status==='rejected',
24
+
};
25
+
26
+
return {
27
+
mergedNotes:Array.from(mergedNotes.values()),
28
+
s3Ids:newSet(s3Notes.map(n=>n.id)),
29
+
gitIds:newSet(gitNotes.map(n=>n.id)),
30
+
// ... maps and sets
31
+
listingSucceeded,
32
+
failedProviders
33
+
};
34
+
```
35
+
36
+
### 1.2 Update `synchronize()` upload decision filter in `src/helpers.js`
37
+
In `synchronize()`, extract `failedProviders` from the result of `listNotes()`.
38
+
When determining `notesToUpload`, check `!failedProviders.<provider_key>` before determining if a note is missing from that provider:
0 commit comments