@@ -192,6 +192,39 @@ export async function _syncPopularityEvery15Minutes() { // exported for unit tes
192192 await S3 . putObject ( EXTENSIONS_BUCKET , POPULARITY_FILE , JSON . stringify ( popularity ) ) ;
193193}
194194
195+ // // to delete an extension, uncomment this function and add
196+ // // removeExtension("extension-id-to-delete") to the end of fn startCollectStarsWorker
197+ // export async function removeExtension(extensionIDToDelete) {
198+ // console.log("getting registry file from S3");
199+ // let registry = JSON.parse(await S3.getObject(EXTENSIONS_BUCKET, REGISTRY_FILE));
200+ // if(!registry[extensionIDToDelete]) {
201+ // console.error("No such extension in registry to delete", extensionIDToDelete);
202+ // return;
203+ // }
204+ // console.log("Deleting extension from registry:", JSON.stringify(registry[extensionIDToDelete], null, 4));
205+ // delete registry[extensionIDToDelete];
206+ //
207+ // let popularity = JSON.parse(await S3.getObject(EXTENSIONS_BUCKET, POPULARITY_FILE));
208+ // console.log("Deleting extension from popularity:", JSON.stringify(popularity[extensionIDToDelete], null, 4));
209+ // if(!popularity[extensionIDToDelete]) {
210+ // console.error("No such extension in popularity to delete", extensionIDToDelete);
211+ // return;
212+ // }
213+ // delete popularity[extensionIDToDelete];
214+ //
215+ // // now update all jsons in registry
216+ // console.log("Writing main registry file after extension removal: ", REGISTRY_FILE);
217+ // await S3.putObject(EXTENSIONS_BUCKET, REGISTRY_FILE, JSON.stringify(registry));
218+ // let registryVersion = JSON.parse(await S3.getObject(EXTENSIONS_BUCKET, REGISTRY_VERSION_FILE));
219+ // registryVersion.version = registryVersion.version + 1;
220+ // console.log("Writing registry version after extension removal file version: ", registryVersion.version,
221+ // REGISTRY_VERSION_FILE);
222+ // await S3.putObject(EXTENSIONS_BUCKET, REGISTRY_VERSION_FILE, JSON.stringify(registryVersion));
223+ // console.log("Writing registry popularity after extension removal file: ", POPULARITY_FILE);
224+ // await S3.putObject(EXTENSIONS_BUCKET, POPULARITY_FILE, JSON.stringify(popularity));
225+ // console.log("Extension successfully deleted with ID", extensionIDToDelete);
226+ // }
227+
195228/* c8 ignore start */
196229// not testing this as no time and is manually tested. If you are touching this code, manual test thoroughly
197230let worker ;
0 commit comments