You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The jobstores.ignore_database_error decorator is applied to various DjangoJobStore methods that interact with the database, and seems to quietly mute a whole range of database-related exceptions.
It looks like this was intended to catch a specific use case to prevent someone from attempting to use django-apscheduler without first applying the Django database migrations, but an unfortunate side-effect is that this decorator can also cause the package to break in unpredictable ways.
An example of a specific issue that I have encountered is outlined below:
If add_job fails because an exception is raised while attempting to create the DjangoJob instance, then:
@ignore_database_error will mute the exception
the DjangoJob instance will never be created; and
the job will not be scheduled; but
scheduler will be unaware of the failure, and give no obvious indication that a problem has occurred apart from logging a warning.
This has the unpleasant consequence that errors might go undetected in a production environment for quite a while before anyone notices that the jobs are not being executed anymore.
It might be preferable for the exceptions to be raised so that the user can decide how best to deal with them - unless I am missing something obvious?
The text was updated successfully, but these errors were encountered:
The
jobstores.ignore_database_error
decorator is applied to variousDjangoJobStore
methods that interact with the database, and seems to quietly mute a whole range of database-related exceptions.It looks like this was intended to catch a specific use case to prevent someone from attempting to use
django-apscheduler
without first applying the Django database migrations, but an unfortunate side-effect is that this decorator can also cause the package to break in unpredictable ways.An example of a specific issue that I have encountered is outlined below:
If
add_job
fails because an exception is raised while attempting to create theDjangoJob
instance, then:@ignore_database_error
will mute the exceptionDjangoJob
instance will never be created; andscheduler
will be unaware of the failure, and give no obvious indication that a problem has occurred apart from logging a warning.This has the unpleasant consequence that errors might go undetected in a production environment for quite a while before anyone notices that the jobs are not being executed anymore.
It might be preferable for the exceptions to be raised so that the user can decide how best to deal with them - unless I am missing something obvious?
The text was updated successfully, but these errors were encountered: