Don't crash metadata API route if timestamp file is not ready
This commit is contained in:
parent
15fcb04368
commit
11684b6fd7
@ -520,15 +520,20 @@ def metadata_v1(config):
|
|||||||
# CORS
|
# CORS
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
last_update = None
|
||||||
try:
|
try:
|
||||||
ts_file = os.path.join(
|
ts_file = os.path.join(
|
||||||
config['data_directory'],
|
config['data_directory'],
|
||||||
'timestamp'
|
'timestamp'
|
||||||
)
|
)
|
||||||
ts = os.path.getmtime(ts_file)
|
last_update = os.path.getmtime(ts_file)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'data': {
|
'data': {
|
||||||
'last_update': ts
|
'last_update': last_update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
except Exception as exc: # pylint: disable= broad-except
|
except Exception as exc: # pylint: disable= broad-except
|
||||||
|
Loading…
Reference in New Issue
Block a user