Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 2c57ada739 Fix: Disable/enable associated cron tasks when subscription is disabled/enabled
When a subscription is disabled, the associated cron tasks (created by the subscription) were still running and updating scripts. This fix ensures that:
- When disabling a subscription, all cron tasks with matching sub_id are also disabled
- When enabling a subscription, all cron tasks with matching sub_id are also enabled

This addresses the actual root cause: subscription tasks don't run when disabled (as the owner correctly pointed out), but the cron tasks created by those subscriptions were still active.

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
2025-11-20 16:11:56 +00:00
copilot-swe-agent[bot] 87a1a3d2eb 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>
2025-11-20 15:50:35 +00:00
copilot-swe-agent[bot] 99064bde10 Initial plan 2025-11-20 15:44:23 +00:00
+10
View File
@@ -350,6 +350,11 @@ export default class SubscriptionService {
for (const doc of docs) {
await this.handleTask(doc.get({ plain: true }), false);
}
// Disable associated cron tasks
const crons = await CrontabModel.findAll({ where: { sub_id: ids } });
if (crons?.length) {
await this.crontabService.disabled(crons.map((x) => x.id!));
}
}
public async enabled(ids: number[]) {
@@ -359,6 +364,11 @@ export default class SubscriptionService {
for (const doc of docs) {
await this.handleTask(doc.get({ plain: true }));
}
// Enable associated cron tasks
const crons = await CrontabModel.findAll({ where: { sub_id: ids } });
if (crons?.length) {
await this.crontabService.enabled(crons.map((x) => x.id!));
}
}
public async log(id: number) {