[fix] GRPC_LOG_EVERY_N_SEC (#33858)

This method was not printing every N seconds. This problem has been seen
many times, sometimes printing erratically, sometimes printing once and
never again.
[Example](https://source.cloud.google.com/results/invocations/32b85281-19ef-4e73-b2c4-cbfe2c1daf9a/targets/%2F%2Ftest%2Fcore%2Fend2end:retry_cancel_after_first_attempt_starts_test@poller%3Depoll1@experiment%3Devent_engine_listener/log)
pull/33869/head
AJ Heller 2 years ago committed by GitHub
parent baa7c1ac4b
commit 6582789e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/core/lib/gprpp/time.h

@ -37,8 +37,8 @@
uint64_t now = grpc_core::Timestamp::FromTimespecRoundDown( \
gpr_now(GPR_CLOCK_MONOTONIC)) \
.milliseconds_after_process_epoch(); \
uint64_t prev_tsamp = prev.exchange(now); \
if (prev_tsamp == 0 || now - prev_tsamp > (n)*1000) { \
if (prev == 0 || now - prev > (n)*1000) { \
prev = now; \
gpr_log(severity, format, __VA_ARGS__); \
} \
} while (0)

Loading…
Cancel
Save