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 GtsStatsdHostTestCases
Bug: 157768117
Change-Id: I1af29b6c83039ab56ef847832a600d4afea34000
This commit is contained in:
Tej Singh
2020-05-29 15:13:23 -07:00
parent d7b08c7690
commit 2330e9be15

View File

@@ -561,7 +561,15 @@ public final class StatsManager {
try {
resultReceiver.pullFinished(atomTag, success, parcels);
} catch (RemoteException e) {
Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId);
Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId
+ " due to TransactionTooLarge. Calling pullFinish with no data");
StatsEventParcel[] emptyData = new StatsEventParcel[0];
try {
resultReceiver.pullFinished(atomTag, /*success=*/false, emptyData);
} catch (RemoteException nestedException) {
Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId
+ " with empty payload");
}
}
});
} finally {