Skip to content

Commit

Permalink
Fix issues with thumbnail generations
Browse files Browse the repository at this point in the history
Sometimes the execution is too fast, the database were not in sync on different thread of celery
  • Loading branch information
lucernae committed Dec 4, 2017
1 parent 897418c commit ba1f745
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion geonode/qgis_server/tasks/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@
from celery.task import task
from requests.exceptions import HTTPError


from geonode.layers.models import Layer
from geonode.layers.utils import create_thumbnail
from geonode.maps.models import Map
from geonode.qgis_server.helpers import map_thumbnail_url, layer_thumbnail_url
from geonode.qgis_server.models import QGISServerLayer

logger = logging.getLogger(__name__)


@task(
name='geonode.qgis_server.tasks.update.create_qgis_server_thumbnail',
queue='update')
queue='update',
autoretry_for=(QGISServerLayer.DoesNotExist, ),
retry_kwargs={'max_retries': 5, 'countdown': 5})
def create_qgis_server_thumbnail(instance, overwrite=False, bbox=None):
"""Task to update thumbnails.
Expand Down Expand Up @@ -92,6 +96,10 @@ def create_qgis_server_thumbnail(instance, overwrite=False, bbox=None):
logger.exception(e)
# reraise exception with original traceback
raise
except QGISServerLayer.DoesNotExist as e:
logger.exception(e)
# reraise exception with original traceback
raise
except Exception as e:
logger.exception(e)
return False
Expand Down

0 comments on commit ba1f745

Please sign in to comment.