Deleting a document type removes a watch folder associated with it without removing the check interval
I had a Document Type (default) which had a watch folder associated with it.
I deleted the document type, and noticed that it also deleted the watch folder with it automatically (which makes sense as they're linked).
However, Mayan doesn't seem to of automatically removed the task to check the interval source and errors will appear in the log as a result of the interval check existing to a source that doesn't exist. At least I think this is what happened.
[2019-12-17 01:06:50,613: INFO/MainProcess] Received task: mayan.apps.sources.tasks.task_check_interval_source[6df3c7ed-e92b-46e1-b953-c2479f130a8e]
[2019-12-17 01:06:50,632: ERROR/ForkPoolWorker-5] Task mayan.apps.sources.tasks.task_check_interval_source[6df3c7ed-e92b-46e1-b953-c2479f130a8e] raised unexpected: UnboundLocalError("local variable 'source' referenced before assignment")
Traceback (most recent call last):
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/sources/tasks.py", line 40, in task_check_interval_source
source = Source.objects.get_subclass(pk=source_id)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/model_utils/managers.py", line 259, in get_subclass
return self.get_queryset().get_subclass(*args, **kwargs)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/model_utils/managers.py", line 231, in get_subclass
return self.select_subclasses().get(*args, **kwargs)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/django/db/models/query.py", line 380, in get
self.model._meta.object_name
mayan.apps.sources.models.base.DoesNotExist: Source matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/mayan-edms/local/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
R = retval = fun(*args, **kwargs)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/celery/app/trace.py", line 648, in __protected_call__
return self.run(*args, **kwargs)
File "/opt/mayan-edms/local/lib/python3.7/site-packages/mayan/apps/sources/tasks.py", line 44, in task_check_interval_source
logger.error('Error processing source: %s; %s', source, exception)
UnboundLocalError: local variable 'source' referenced before assignment```