@rmdes/indiekit-endpoint-github 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/starred-cache.js +11 -12
- package/package.json +1 -1
package/lib/starred-cache.js
CHANGED
|
@@ -86,21 +86,20 @@ export async function annotateWithLists(db, lists) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
];
|
|
89
|
+
// Reset all repos' lists first, then annotate per-repo
|
|
90
|
+
await collection.updateMany({}, { $set: { lists: [] } });
|
|
91
|
+
|
|
92
|
+
const annotateOps = [...repoToLists.entries()].map(([fullName, slugs]) => ({
|
|
93
|
+
updateOne: {
|
|
94
|
+
filter: { fullName },
|
|
95
|
+
update: { $set: { lists: slugs } },
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
99
98
|
|
|
100
99
|
// Process in batches of 1000 to avoid MongoDB limits
|
|
101
100
|
let reposAnnotated = 0;
|
|
102
|
-
for (let i = 0; i <
|
|
103
|
-
const batch =
|
|
101
|
+
for (let i = 0; i < annotateOps.length; i += 1000) {
|
|
102
|
+
const batch = annotateOps.slice(i, i + 1000);
|
|
104
103
|
const result = await collection.bulkWrite(batch, { ordered: true });
|
|
105
104
|
reposAnnotated += result.modifiedCount;
|
|
106
105
|
}
|
package/package.json
CHANGED