From c95f7819017eeeccfb78cab728c3c443546affed Mon Sep 17 00:00:00 2001 From: Tej Singh Date: Fri, 29 May 2020 15:21:08 -0700 Subject: [PATCH] Retry pullfinish with empty payload if call fails If the first call for pullFinished fails, it is likely because the transaction is too large. Currently, if this happens statsd will just sleep until the timeout. With this change, the client will retry calling pullFinish if the first attempt fails, but with an empty payload (and with success = false) to cause the puller to fail fast, and so statsd does not wait for the timeout. Test: atest LibStatsPullTests Bug: 157768117 Change-Id: I3af991fae47bb7c09bf8a6fc83f28556b836c6e4 --- libstats/pull/stats_pull_atom_callback.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libstats/pull/stats_pull_atom_callback.cpp b/libstats/pull/stats_pull_atom_callback.cpp index 2d184bd2d..bc34c6335 100644 --- a/libstats/pull/stats_pull_atom_callback.cpp +++ b/libstats/pull/stats_pull_atom_callback.cpp @@ -131,7 +131,11 @@ class StatsPullAtomCallbackInternal : public BnPullAtomCallback { parcels.push_back(std::move(p)); } - resultReceiver->pullFinished(atomTag, success, parcels); + Status status = resultReceiver->pullFinished(atomTag, success, parcels); + if (!status.isOk()) { + std::vector emptyParcels; + resultReceiver->pullFinished(atomTag, /*success=*/false, emptyParcels); + } for (int i = 0; i < statsEventList.data.size(); i++) { AStatsEvent_release(statsEventList.data[i]); }