From 87a1a3d2eb18bb40443fc0444d469c71f938814a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 20 Nov 2025 15:50:35 +0000 Subject: [PATCH] Fix disabled subscriptions still updating tasks - Filter setSshConfig() to only configure SSH keys for enabled subscriptions - Remove SSH keys when subscriptions are disabled - This prevents disabled subscriptions from running scheduled tasks Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- back/services/subscription.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/back/services/subscription.ts b/back/services/subscription.ts index 1a8638f8..7ae3b789 100644 --- a/back/services/subscription.ts +++ b/back/services/subscription.ts @@ -112,7 +112,9 @@ export default class SubscriptionService { } public async setSshConfig() { - const docs = await SubscriptionModel.findAll(); + const docs = await SubscriptionModel.findAll({ + where: { is_disabled: 0 }, + }); await this.sshKeyService.setSshConfig(docs); } @@ -346,6 +348,14 @@ export default class SubscriptionService { public async disabled(ids: number[]) { await SubscriptionModel.update({ is_disabled: 1 }, { where: { id: ids } }); const docs = await SubscriptionModel.findAll({ where: { id: ids } }); + // Remove SSH keys for disabled subscriptions + for (const doc of docs) { + if (doc.type === 'private-repo' && doc.pull_type === 'ssh-key') { + const { alias } = doc; + const { host } = formatUrl(doc); + await this.sshKeyService.removeSSHKey(alias, host, doc.proxy); + } + } await this.setSshConfig(); for (const doc of docs) { await this.handleTask(doc.get({ plain: true }), false);