Skip to content

Commit 30f143b

Browse files
authored
Add option to preserve ids that are provided as arguments with --prepare-jobs (#836)
If you try to combine --prepare-jobs and running Job IDs in one command the ids got ignores since prepare_jobs overrides the set. With this small change we use a set instead of a list we use a set and merge them later together to preserve other scheduled jobs.
1 parent 1d24dd9 commit 30f143b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/urlwatch/command.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ def test_filter(self, id):
143143
return 0
144144

145145
def prepare_jobs(self):
146-
new_jobs = []
146+
new_jobs = set()
147147
for idx, job in enumerate(self.urlwatcher.jobs):
148148
has_history = self.urlwatcher.cache_storage.has_history_data(job.get_guid())
149149
if not has_history:
150150
logger.info('Add Job: %s', job.pretty_name())
151-
new_jobs.append(idx + 1)
152-
if not new_jobs:
151+
new_jobs.add(idx + 1)
152+
if not new_jobs and not self.urlwatch_config.idx_set:
153153
return 0
154-
self.urlwatch_config.idx_set = frozenset(new_jobs)
154+
self.urlwatch_config.idx_set = self.urlwatch_config.idx_set.union(new_jobs)
155155
self.urlwatcher.run_jobs()
156156
self.urlwatcher.close()
157157

0 commit comments

Comments
 (0)