songgaoye opened a new pull request, #3610:
URL: https://github.com/apache/brpc/pull/3610

   ### What problem does this PR solve?
   
   Issue Number: resolve
   
   Problem Summary:
   
   `PrometheusMetrics.sanity` waits for asynchronous server method metrics to be
   exposed after `Server::Start()`.
   
   The test used a fixed number of `bthread_usleep()` calls. Since
   `bthread_usleep()` may return early when interrupted, the loop can finish in 
a
   few milliseconds instead of waiting for its intended five seconds. This makes
   the test flaky when `UpdateDerivedVars` has not yet exposed the method bvars.
   
   ### What is changed and the side effects?
   
   Changed:
   
   - Replace the fixed retry count with a five-second deadline based on
     `butil::cpuwide_time_us()`.
   - Continue polling until the expected bvar is exposed or the deadline 
expires.
   
   Side effects:
   
   * Performance effects:
   
     None. This only affects a unit test.
   
   * Breaking backward compatibility:
   
     None.
   
   * * *
   
   ### Check List:
   
   - [x] Build `brpc_prometheus_metrics_unittest`
   - [x] Run `PrometheusMetrics.sanity`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to