Skip to content

Commit

Permalink
Fix issues suggested by linter
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Brain <[email protected]>
  • Loading branch information
ABrain7710 committed Jan 23, 2024
1 parent 888dd23 commit eb3887f
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions augur/application/db/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ def insert_data(self, data: Union[List[dict], dict], table, natural_keys: List[s
#self.logger.info(e)
if(len(data) == 1):
raise e
else:
time.sleep(3)
first_half = data[:len(data)//2]
second_half = data[len(data)//2:]

time.sleep(3)
first_half = data[:len(data)//2]
second_half = data[len(data)//2:]

self.insert_data(first_half, table,natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(second_half,table, natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(first_half, table, natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(second_half,table, natural_keys, return_columns, string_fields, on_conflict_update)

else:
self.logger.error("Unable to insert data in 10 attempts")
Expand Down Expand Up @@ -232,18 +232,15 @@ def insert_data(self, data: Union[List[dict], dict], table, natural_keys: List[s
raise e

except Exception as e:
if(len(data) == 1):
if len(data) == 1:
raise e
else:
time.sp
first_half = data[:len(data)//2]
second_half = data[len(data)//2:]

self.insert_data(first_half, natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(second_half, natural_keys, return_columns, string_fields, on_conflict_update)

time.sleep(3)
first_half = data[:len(data)//2]
second_half = data[len(data)//2:]

self.insert_data(first_half, table, natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(second_half, table, natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(first_half, table, natural_keys, return_columns, string_fields, on_conflict_update)
self.insert_data(second_half, table, natural_keys, return_columns, string_fields, on_conflict_update)

else:
self.logger.error("Unable to insert and return data in 10 attempts")
Expand Down

0 comments on commit eb3887f

Please sign in to comment.