Calculating time-to-import for map pbf files in the backend. These times were created using a test RPi4. Encoding URL of archive files to prevent error which blocked displaying of archives.

This commit is contained in:
Roland 2022-03-12 09:50:16 -07:00
parent 6a22090e54
commit c815aa68c6
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
10 changed files with 46 additions and 59 deletions

View file

@ -113,12 +113,14 @@ async def import_pbf(pbf: Path):
stdout, stderr = await proc.communicate()
elapsed = now() - start
logger.info(f'Import of {pbf} took {timedelta_to_timestamp(elapsed)}')
success = 'Successful' if proc.returncode == 0 else 'Unsuccessful'
logger.info(f'{success} import of {pbf.name} took {timedelta_to_timestamp(elapsed)}')
if proc.returncode != 0:
# Log all lines. Truncate long lines.
for line in stdout.decode().splitlines():
logger.info(line)
logger.debug(line[:500])
for line in stderr.decode().splitlines():
logger.error(line)
logger.error(line[:500])
raise ValueError(f'Importing PBF failed with return code {proc.returncode}')