fix: [data_rentention_engine] fix object first/last seen

pull/594/head
Terrtia 2023-01-10 11:41:21 +01:00
parent b0891f45ec
commit 7fa19efc1e
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 6 additions and 2 deletions

View File

@ -51,7 +51,7 @@ def get_obj_date_first(obj_type, subtype='', r_int=False):
first = r_obj.hget(f'date:first', f'{obj_type}:{subtype}') first = r_obj.hget(f'date:first', f'{obj_type}:{subtype}')
if r_int: if r_int:
if not first: if not first:
return 0 return 99999999
else: else:
return int(first) return int(first)
return first return first
@ -62,7 +62,7 @@ def get_obj_date_last(obj_type, subtype='', r_int=False):
last = r_obj.hget(f'date:last', f'{obj_type}:{subtype}') last = r_obj.hget(f'date:last', f'{obj_type}:{subtype}')
if r_int: if r_int:
if not last: if not last:
return 99999999 return 0
else: else:
return int(last) return int(last)
return last return last
@ -93,3 +93,7 @@ def update_obj_date(date, obj_type, subtype=''):
set_obj_date_last(date, obj_type, subtype=subtype) set_obj_date_last(date, obj_type, subtype=subtype)
if __name__ == '__main__':
print(r_obj.hgetall(f'date:first'))
print(r_obj.hgetall(f'date:last'))