Skip to content

Commit 9d694e0

Browse files
committed
create snapshot if thumbnail is empty, longer timeout values for snapshot generation
1 parent dbabcf8 commit 9d694e0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

django/gsmap/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def create_screenshot_file(self, is_thumbnail=False):
160160
if is_thumbnail:
161161
url += '&thumbnail'
162162
path = 'snapshot-thumbnails'
163-
response = requests.get(url, timeout=(5, 30))
163+
response = requests.get(url, timeout=(10, 50))
164164
date_suffix = timezone.now().strftime("%Y-%m-%d_%H-%M-%SZ")
165165
screenshot_file = SimpleUploadedFile(
166166
f'{path}/{self.pk}_{date_suffix}.png',
@@ -196,7 +196,9 @@ def save_screenshot():
196196
post_save.disconnect(save_screenshot_handler, sender=Snapshot)
197197
instance = kwargs.get('instance')
198198
# only create snapshot if data changed
199-
if instance.data_changed(['data', 'screenshot_generated', 'thumbnail_generated']):
199+
if instance.data_changed([
200+
'data', 'screenshot_generated', 'thumbnail_generated'
201+
]) or not bool(instance.thumbnail_generated):
200202
if not 'resources' in instance.data:
201203
return
202204
try:

django/main/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from django.conf import settings
22
from django.contrib import admin
33
from django.urls import path
4-
from graphene_django.views import GraphQLView
54
from django.views.decorators.csrf import csrf_exempt
5+
from graphene_django.views import GraphQLView
66

77
urlpatterns = [
88
path('gmanage/', admin.site.urls),

0 commit comments

Comments
 (0)