Open ernstwi opened 2 years ago
In general we really do not want any error in syncing one course to affect other courses. This seems to work in the current setup. We use a ThreadPoolExecutor.map to iterate over courses.
with ThreadPoolExecutor(max_workers=self.max_workers) as executor:
res = list(executor.map(self.sync_one, groups))
Relevant part of the documentation is:
If a func call raises an exception, then that exception will be raised when its value is retrieved from the iterator.
So map returns an iterator with the results of each call to sync_one
. In making a list from the iterable, we retrieve each value from the iterator. So if one call to sync_one
raises an exception, this exception is re-raised only after the ThreadPoolExecutor is done and has synced every course. The exception is caught and logged by JobScheduler
, and the next job is not affected.
In conclusion this case when a course is deleted will cause an exception to be logged on log level warning
, but it will not cause any malfunction.
Mitigated by #35 #36 #37
If there is a Connection for a course, and the course is then deleted on Canvas, the Connection should be deleted from the database so syncing is not attempted.