fixes
This commit is contained in:
parent
9a370f817a
commit
4505e4f2ed
@ -295,7 +295,7 @@ async def _ha_replicate_by_ha(request: Request):
|
|||||||
logger.error(f'Version missmatch on HA replication task!')
|
logger.error(f'Version missmatch on HA replication task!')
|
||||||
return JSONr(status_code=503, content={'status': 503, 'detail': 'Missmatch for "INSTANCE_REF"'})
|
return JSONr(status_code=503, content={'status': 503, 'detail': 'Missmatch for "INSTANCE_REF"'})
|
||||||
|
|
||||||
sync_timestamp, max_seconds_behind = j.get('sync_timestamp'), 30
|
sync_timestamp, max_seconds_behind = datetime.fromisoformat(j.get('sync_timestamp')), 30
|
||||||
if sync_timestamp <= cur_time - timedelta(seconds=max_seconds_behind):
|
if sync_timestamp <= cur_time - timedelta(seconds=max_seconds_behind):
|
||||||
logger.error(f'Request time more than {max_seconds_behind}s behind!')
|
logger.error(f'Request time more than {max_seconds_behind}s behind!')
|
||||||
return JSONr(status_code=503, content={'status': 503, 'detail': 'Request time behind'})
|
return JSONr(status_code=503, content={'status': 503, 'detail': 'Request time behind'})
|
||||||
@ -310,7 +310,7 @@ async def _ha_replicate_by_ha(request: Request):
|
|||||||
for lease in leases:
|
for lease in leases:
|
||||||
lease_ref = lease.get('lease_ref')
|
lease_ref = lease.get('lease_ref')
|
||||||
x = Lease.find_by_lease_ref(db, lease_ref)
|
x = Lease.find_by_lease_ref(db, lease_ref)
|
||||||
if x.lease_updated > remote_time:
|
if x.lease_updated > sync_timestamp:
|
||||||
continue
|
continue
|
||||||
logging.info(f'> [ ha ]: lease {lease_ref}')
|
logging.info(f'> [ ha ]: lease {lease_ref}')
|
||||||
data = Lease.deserialize(lease)
|
data = Lease.deserialize(lease)
|
||||||
|
Loading…
Reference in New Issue
Block a user