mirror of
https://github.com/whyour/qinglong.git
synced 2025-12-15 08:25:38 +08:00
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>
This commit is contained in:
parent
99064bde10
commit
87a1a3d2eb
|
|
@ -112,7 +112,9 @@ export default class SubscriptionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async setSshConfig() {
|
public async setSshConfig() {
|
||||||
const docs = await SubscriptionModel.findAll();
|
const docs = await SubscriptionModel.findAll({
|
||||||
|
where: { is_disabled: 0 },
|
||||||
|
});
|
||||||
await this.sshKeyService.setSshConfig(docs);
|
await this.sshKeyService.setSshConfig(docs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,6 +348,14 @@ export default class SubscriptionService {
|
||||||
public async disabled(ids: number[]) {
|
public async disabled(ids: number[]) {
|
||||||
await SubscriptionModel.update({ is_disabled: 1 }, { where: { id: ids } });
|
await SubscriptionModel.update({ is_disabled: 1 }, { where: { id: ids } });
|
||||||
const docs = await SubscriptionModel.findAll({ 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();
|
await this.setSshConfig();
|
||||||
for (const doc of docs) {
|
for (const doc of docs) {
|
||||||
await this.handleTask(doc.get({ plain: true }), false);
|
await this.handleTask(doc.get({ plain: true }), false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user