Skip to content

Commit

Permalink
Fix minor display bug in delete_snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
vaultah committed Feb 14, 2022
1 parent 43fd874 commit cc00f88
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions replicat/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,30 +1174,31 @@ async def delete_snapshots(self, snapshots):
disable=self._quiet,
leave=True,
)

async def _delete_snapshot(location):
async with self._acquire_slot():
await self._awrap(self.backend.delete, location)
finished_snapshots_tracker.update()

with finished_snapshots_tracker:
await asyncio.gather(*map(_delete_snapshot, snapshots_locations))

finished_chunks_tracker = tqdm(
desc='Unreferenced chunks deleted',
unit='',
total=len(chunks_digests),
position=1,
position=0,
disable=self._quiet,
leave=True,
)

async def _delete_snapshot(location):
async with self._acquire_slot():
await self._awrap(self.backend.delete, location)
finished_snapshots_tracker.update()

async def _delete_chunk(digest):
async with self._acquire_slot():
await self._awrap(
self.backend.delete, self._chunk_digest_to_location(digest)
)
finished_chunks_tracker.update()

with finished_snapshots_tracker:
await asyncio.gather(*map(_delete_snapshot, snapshots_locations))

with finished_chunks_tracker:
await asyncio.gather(*map(_delete_chunk, chunks_digests))

Expand Down

0 comments on commit cc00f88

Please sign in to comment.