follow up from #21917 either make it faster or make it more resilient when shutting down to not lead to bad states