PDS Admin tool make it easier to moderate your PDS with labels

Should send jobs to the queue and let them properly run there

+15 -15
+4 -2
src/handlers/handleNewLabel.ts
··· 112 112 113 113 // Perform action 114 114 if (labelConfig.action === "notify") { 115 - mailQueue.add(() => 115 + await mailQueue.add(() => 116 116 sendLabelNotification(pdsConfig.notifyEmails, { 117 117 did: targetDid, 118 118 pds: pdsConfig.host, ··· 120 120 labeler: config.host, 121 121 negated: label.neg ?? false, 122 122 dateApplied: labledDate, 123 - }).catch((err) => logger.error({ err }, "Error sending label notification email")), 123 + }).catch((err) => 124 + logger.error({ err }, "Error sending label notification email"), 125 + ), 124 126 ); 125 127 } 126 128
+2 -2
src/handlers/lablerSubscriber.ts
··· 53 53 } 54 54 case "com.atproto.label.subscribeLabels#labels": { 55 55 for (const label of message.labels) { 56 - queue.add(async () => { 57 - await handleNewLabel(config, label, db, pdsConfigs, mailQueue); 56 + await queue.add(() => { 57 + handleNewLabel(config, label, db, pdsConfigs, mailQueue); 58 58 }); 59 59 } 60 60 break;
+7 -8
src/handlers/pdsSubscriber.ts
··· 39 39 }, 40 40 "Identity event", 41 41 ); 42 - queue.add( 43 - async () => 44 - await handleNewIdentityEvent( 45 - db, 46 - config.host, 47 - message.did, 48 - message.active, 49 - ), 42 + await queue.add(() => 43 + handleNewIdentityEvent( 44 + db, 45 + config.host, 46 + message.did, 47 + message.active, 48 + ), 50 49 ); 51 50 52 51 break;
+2 -3
src/pds.ts
··· 32 32 33 33 for (const repo of result.repos) { 34 34 if (repo.active) { 35 - queue.add( 36 - async () => 37 - await handleNewIdentityEvent(db, config.host, repo.did, true), 35 + await queue.add(() => 36 + handleNewIdentityEvent(db, config.host, repo.did, true), 38 37 ); 39 38 } 40 39 }