async def METHOD_NAME(
    self, visit_id: VisitId, interrupted: bool = False
) -> Task[None]:
    async with self.lock as _:
        self.logger.info(
            f"Finalizing visit_id {visit_id} which was {'' if interrupted else 'not'} interrupted"
        )
        for table, record_list in self.cache1[visit_id].items():
            self.cache2[table].extend(record_list)
        del self.cache1[visit_id]
        async def wait(signal: Event) -> None:
            await signal.wait()
        ev = Event()
        self.signal_list.append(ev)
        return asyncio.create_task(wait(ev))