/// <summary> /// Queries the endpoint for the RequestId. /// This method should be called only after the request has been created, otherwise, it will throw an exception. /// </summary> /// <remarks> /// On workers, m_requestId won't be initialized, so we need to query the server for the right value. /// </remarks> private async Task EnsureRequestIdInitalizedAsync() { if (string.IsNullOrEmpty(m_requestId)) { var result = await m_symbolClient.GetRequestByNameAsync(RequestName, CancellationToken); m_requestId = result.Id; } }
/// <summary> /// Queries the endpoint for the RequestId. /// This method should be called only after the request has been created, otherwise, it will throw an exception. /// </summary> /// <remarks> /// On workers, m_requestId / m_domainId won't be initialized, so we need to query the server for the right values. /// </remarks> private async Task EnsureRequestIdAndDomainIdAreInitalizedAsync() { if (string.IsNullOrEmpty(m_requestId) || m_domainId == null) { using (m_counters.StartStopwatch(SymbolClientCounter.GetRequestIdDuration)) { var result = await m_symbolClient.GetRequestByNameAsync(RequestName, CancellationToken); m_requestId = result.Id; m_domainId = result.DomainId; } } }
/// <summary> /// Queries the endpoint for the RequestId. /// This method should be called only after the request has been created, otherwise, it will throw an exception. /// </summary> /// <remarks> /// On workers, m_requestId / m_domainId won't be initialized, so we need to query the server for the right values. /// </remarks> private async Task EnsureRequestIdAndDomainIdAreInitalizedAsync() { // Check whether the field is initialized, so we are not wastefully acquire the semaphore. if (string.IsNullOrEmpty(m_requestId)) { using (await m_requestIdAcquisitionMutex.AcquireAsync()) { // check whether we still need to query the server if (string.IsNullOrEmpty(m_requestId) || m_domainId == null) { using (m_counters.StartStopwatch(SymbolClientCounter.GetRequestIdDuration)) { var result = await m_symbolClient.GetRequestByNameAsync(RequestName, CancellationToken); m_requestId = result.Id; m_domainId = result.DomainId; } } } } }