Skip to content

Commit 41cd88b

Browse files
authored
Merge pull request #81 from benoitblanc/generate-thumbnail-timeout
Add configurable timeout for generating thumbnail
2 parents c847713 + 7f02c7e commit 41cd88b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

schemas/qwc-config-generator.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@
143143
"use_default_map_thumbnail": {
144144
"description": "Whether to use the default mapthumb (mapthumbs/default.jpg) instead of generating the thumbnail via GetMap if no custom thumbnail is provided. Default: false"
145145
},
146+
"generate_thumbnail_timeout": {
147+
"description": "Timeout for GetMap request when generating thumbnail. Default: 10sec",
148+
"type": "number"
149+
},
146150
"ignore_errors": {
147151
"description": "Ignore errors during generation to allow creating configuration files despite some errors. Default: false",
148152
"type": "boolean"

src/config_generator/map_viewer_config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ def __init__(self, tenant_path, generator_config, themes_reader,
8888
'use_default_map_thumbnail', False
8989
)
9090

91+
# Timeout for generating thumbnail via GetMap request
92+
self.generate_thumbnail_timeout = generator_config.get(
93+
"generate_thumbnail_timeout", 10
94+
)
95+
9196
# keep track of theme IDs for uniqueness
9297
self.theme_ids = []
9398

@@ -604,7 +609,7 @@ def get_thumbnail(self, cfg_item, service_name, capabilities, assets_dir):
604609
'BBOX': (",".join(map(str, adjustedExtent))),
605610
'LAYERS': (",".join(layers).encode('utf-8'))
606611
},
607-
timeout=10
612+
timeout=self.generate_thumbnail_timeout
608613
)
609614

610615
if response.status_code != requests.codes.ok:

0 commit comments

Comments
 (0)