Mercurial > gemma
annotate pkg/imports/erdms.go @ 5679:03dfbe675842 sr-v2
Simplified version handling.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 11 Feb 2024 12:37:09 +0100 |
parents | 57c655b93ba8 |
children |
rev | line source |
---|---|
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 // |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 // |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
7 // Copyright (C) 2018, 2019 by via donau |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
10 // |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
13 // * Tom Gottfried <tom.gottfried@intevation.de> |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 package imports |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 import ( |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
18 "context" |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 "database/sql" |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 "fmt" |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 "strings" |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
22 |
5610
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
23 "gemma.intevation.de/gemma/pkg/config" |
5490
5f47eeea988d
Use own logging package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3551
diff
changeset
|
24 "gemma.intevation.de/gemma/pkg/log" |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
25 "gemma.intevation.de/gemma/pkg/soap" |
5609
e1936db6db8e
Adjust ta erdms data structure.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5490
diff
changeset
|
26 erdms "gemma.intevation.de/gemma/pkg/soap/erdms2" |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 ) |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
29 const ( |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
30 selectUserCountriesSQL = ` |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
31 SELECT DISTINCT country FROM users.list_users |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
32 WHERE country <> '--' |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
33 ` |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
34 ) |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
35 |
3163
d9903cb34842
Handle failing INSERTs gracefully during gauges import
Tom Gottfried <tom@intevation.de>
parents:
3161
diff
changeset
|
36 func userCountries(ctx context.Context, conn *sql.Conn) ([]string, error) { |
d9903cb34842
Handle failing INSERTs gracefully during gauges import
Tom Gottfried <tom@intevation.de>
parents:
3161
diff
changeset
|
37 rows, err := conn.QueryContext(ctx, selectUserCountriesSQL) |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
38 if err != nil { |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
39 return nil, err |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
40 } |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
41 defer rows.Close() |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
42 |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
43 var countries []string |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
44 |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
45 for rows.Next() { |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
46 var country string |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
47 if err = rows.Scan(&country); err != nil { |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
48 return nil, err |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
49 } |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
50 countries = append(countries, country) |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
51 } |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
52 |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
53 if err := rows.Err(); err != nil { |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
54 return nil, err |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
55 } |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
56 |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
57 return countries, nil |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
58 } |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
59 |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
60 func getRisData( |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
61 ctx context.Context, |
3163
d9903cb34842
Handle failing INSERTs gracefully during gauges import
Tom Gottfried <tom@intevation.de>
parents:
3161
diff
changeset
|
62 conn *sql.Conn, |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
63 feedback Feedback, |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
64 username string, |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
65 password string, |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
66 URL string, |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
67 insecure bool, |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
68 funcode string, |
3551
a5448426e4e2
Only erase gauges that have been requested from ERDMS
Tom Gottfried <tom@intevation.de>
parents:
3163
diff
changeset
|
69 ) ([]*erdms.GetRisDataXMLResponse, []string, error) { |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
70 |
3163
d9903cb34842
Handle failing INSERTs gracefully during gauges import
Tom Gottfried <tom@intevation.de>
parents:
3161
diff
changeset
|
71 countries, err := userCountries(ctx, conn) |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
72 if err != nil { |
3551
a5448426e4e2
Only erase gauges that have been requested from ERDMS
Tom Gottfried <tom@intevation.de>
parents:
3163
diff
changeset
|
73 return nil, nil, err |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
74 } |
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
75 |
5610
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
76 var auth soap.Auth |
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
77 |
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
78 if tokenURL := config.TokenURL(); tokenURL != "" && username != "" { |
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
79 token, err := soap.FetchToken(tokenURL, username, password) |
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
80 if err != nil { |
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
81 return nil, nil, fmt.Errorf( |
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
82 "error requesting token for ERDMS service: %w", err) |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
83 } |
5610
a826d84485c8
Use token server to fetch token for ERDMS requests.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5609
diff
changeset
|
84 auth = token |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
85 } |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
86 |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
87 client := erdms.NewRefService(URL, insecure, auth) |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
88 |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
89 var responseData []*erdms.GetRisDataXMLResponse |
5618
57c655b93ba8
Suppress namespace for erdms.GetRisDataXML SOAP call args.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5610
diff
changeset
|
90 |
57c655b93ba8
Suppress namespace for erdms.GetRisDataXML SOAP call args.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5610
diff
changeset
|
91 fcode := erdms.NoNS{Text: funcode} |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
92 for _, country := range countries { |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
93 |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
94 feedback.Info("Request RIS index for country %s", country) |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
95 |
5618
57c655b93ba8
Suppress namespace for erdms.GetRisDataXML SOAP call args.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5610
diff
changeset
|
96 subcode := erdms.NoNS{Text: country + "%"} |
5609
e1936db6db8e
Adjust ta erdms data structure.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5490
diff
changeset
|
97 |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
98 request := &erdms.GetRisDataXML{ |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
99 GetRisDataXMLType: &erdms.GetRisDataXMLType{ |
5609
e1936db6db8e
Adjust ta erdms data structure.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5490
diff
changeset
|
100 Subcode: &subcode, |
5618
57c655b93ba8
Suppress namespace for erdms.GetRisDataXML SOAP call args.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5610
diff
changeset
|
101 Funcode: &fcode, |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
102 }, |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
103 } |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
104 |
3161
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
105 const maxTries = 3 |
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
106 |
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
107 tries := 0 |
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
108 |
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
109 again: |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
110 data, err := client.GetRisDataXML(request) |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
111 if err != nil { |
3161
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
112 if t, ok := err.(interface{ Timeout() bool }); ok && t.Timeout() && tries < maxTries { |
5490
5f47eeea988d
Use own logging package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3551
diff
changeset
|
113 log.Warnln("warn: ERDMS SOAP request timed out. Trying again.") |
3161
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
114 tries++ |
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
115 goto again |
6a44a89ffb51
SOAP: Added a globally configurable timeout (default 1min) till a SOAP request is canceled.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2988
diff
changeset
|
116 } |
3551
a5448426e4e2
Only erase gauges that have been requested from ERDMS
Tom Gottfried <tom@intevation.de>
parents:
3163
diff
changeset
|
117 return nil, nil, fmt.Errorf( |
a5448426e4e2
Only erase gauges that have been requested from ERDMS
Tom Gottfried <tom@intevation.de>
parents:
3163
diff
changeset
|
118 "Error requesting ERDMS service: %v", err) |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
119 } |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
120 responseData = append(responseData, data) |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
121 } |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
122 |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
123 feedback.Info("Import data for countries: %s.", |
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
124 strings.Join(countries, ", ")) |
2988
e1ccc8438529
DMV: separated fetching list of countries from database from requesting the RIS index. Also added some logging and better error handling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
125 |
3551
a5448426e4e2
Only erase gauges that have been requested from ERDMS
Tom Gottfried <tom@intevation.de>
parents:
3163
diff
changeset
|
126 return responseData, countries, nil |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
127 } |