withPermits(1), which works fine. However, I'd also like to block subsequent requests while refreshing the session. So, not only would I prevent others from trying to refresh the session, but I'd also queue up any subsequent requests made after we've started refreshing the session (blocking them with another semaphore) until the session is refreshed successfully.withPermitsIfAvailable(permits: number) is close to what I want but it doesn't block - it just returns none if permits aren't available (but I also don't want to optimistically take it, otherwise all requests would be sequential).