Skip to content

Commit

Permalink
Handle WMS requests with HTTP error more efficiently in timgen
Browse files Browse the repository at this point in the history
  • Loading branch information
jirik committed Nov 22, 2023
1 parent 576ec02 commit 227ac1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#### Data migrations
### Changes
- All changes from [v1.22.1](#v1221) and [v1.22.2](#v1222).
- [#960](https://github.com/LayerManager/layman/issues/960) Handle WMS requests with HTTP error more efficiently in timgen.

## v1.22.2
2023-11-10
Expand Down
10 changes: 5 additions & 5 deletions timgen/src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ const proxify_layer_loader = (layer, tiled, gs_public_url, gs_url, headers) => {
}).then(res => {
const headers = [...res.headers];
log(`load_fn.fetch_retry, res.status=${res.status}, headers=${JSON.stringify(headers, null, 2)}, image_url=${image_url}`)
if(res.headers.get('content-type').includes('text/xml')) {
return Promise.all([false, res.text()])
} else {
return Promise.all([true, res.blob()])
}
const is_xml = (res.headers.get('content-type') || '').includes('text/xml')
const ok = res.status < 400 && !is_xml
return Promise.all([ok, (ok ? res.blob() : res.text())])
}).catch(reason => {
log(`load_fn.fetch_retry, catch reason=${reason}`)
});

log(`load_fn.fetch_retry, loaded, ok=${ok}, image_url=${image_url}`)
Expand Down

0 comments on commit 227ac1b

Please sign in to comment.