check number of connections before telling the goroutine to delete them