# Frequency garbage collection will run (setting to 0 or false to disable)
# Setting units are minutes.
-## NOTE: This is temporarily disabled, but we want to set it back:
-## garbage_collection = integer(default=60)
-garbage_collection = integer(default=0)
+garbage_collection = integer(default=60)
[jinja2]
# Jinja2 supports more directives than the minimum required by mediagoblin.
entry = mgg.database.MediaEntry.query.filter_by(id=entry_id).first()
json_processing_callback(entry)
+ mgg.database.reset_after_request()
+
+ def after_return(self, *args, **kwargs):
+ """
+ This is called after the task has returned, we should clean up.
+
+ We need to rollback the database to prevent ProgrammingError exceptions
+ from being raised.
+ """
+ # In eager mode we get DetachedInstanceError, we do rollback on_failure
+ # to deal with that case though when in eager mode.
+ if not celery.app.default_app.conf['CELERY_ALWAYS_EAGER']:
+ mgg.database.reset_after_request()
+
tasks.register(ProcessMedia)