Skip to content

Commit

Permalink
client: init_columns where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Dec 4, 2021
1 parent 73d6799 commit 3c02ade
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,15 +921,14 @@ def delete_contributions(self, query: dict = None, timeout: int = -1):
_run_futures(futures, total=total, timeout=timeout)
left, _ = self.get_totals(query=query)
deleted = total - left
self.init_columns()
self._reinit()
toc = time.perf_counter()
dt = (toc - tic) / 60
print(f"It took {dt:.1f}min to delete {deleted} contributions.")

if left:
print(f"There were errors and {left} contributions are left to delete!")
else:
self.init_columns({})

def get_totals(
self,
Expand Down Expand Up @@ -1273,6 +1272,7 @@ def update_contributions(
new_paths = set(c["path"] for c in resp["columns"])

if new_paths != old_paths:
self.init_columns()
self._reinit()

toc = time.perf_counter()
Expand Down Expand Up @@ -1676,6 +1676,7 @@ def put_future(pk, payload):

toc = time.perf_counter()
dt = (toc - tic) / 60
self.init_columns()
self._reinit()
self.session.close()
self.session = get_session()
Expand Down

0 comments on commit 3c02ade

Please sign in to comment.