private async Task queryAPI() { while (true) { if (connectedServers.Count > 0) { rc.makeRequest("", null, async response => { if (response == null) { return; } await onEventReceived(response.Content); }); } await Task.Delay(5000); } }