Data converter
This commit is contained in:
@@ -112,8 +112,8 @@ async function forwardGeocode(address) {
|
||||
}
|
||||
|
||||
try {
|
||||
// Add delay to respect rate limits
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
// Add delay to respect rate limits - increase delay for batch processing
|
||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
||||
|
||||
logger.info(`Forward geocoding: ${address}`);
|
||||
|
||||
@@ -126,9 +126,9 @@ async function forwardGeocode(address) {
|
||||
'accept-language': 'en'
|
||||
},
|
||||
headers: {
|
||||
'User-Agent': 'NocoDB Map Viewer 1.0 (https://github.com/yourusername/nocodb-map-viewer)'
|
||||
'User-Agent': 'NocoDB Map Viewer 1.0 (contact@example.com)'
|
||||
},
|
||||
timeout: 10000
|
||||
timeout: 15000 // Increase timeout to 15 seconds
|
||||
});
|
||||
|
||||
if (!response.data || response.data.length === 0) {
|
||||
@@ -151,10 +151,16 @@ async function forwardGeocode(address) {
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded. Please try again later.');
|
||||
} else if (error.response?.status === 403) {
|
||||
throw new Error('Access denied by geocoding service');
|
||||
} else if (error.response?.status === 500) {
|
||||
throw new Error('Geocoding service internal error');
|
||||
} else if (error.code === 'ECONNABORTED') {
|
||||
throw new Error('Geocoding service timeout');
|
||||
throw new Error('Geocoding request timeout');
|
||||
} else if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
|
||||
throw new Error('Cannot connect to geocoding service');
|
||||
} else {
|
||||
throw new Error('Geocoding service unavailable');
|
||||
throw new Error(`Geocoding failed: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user