Add human-readable responses when manually running batch []s

This will make potential issues a little nicer to debug in the future, because
the person hitting these endpoints manually will immediately know why they may
not be kicking off a [] console as might be expected.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134840223
This commit is contained in:
mcilwain 2016-09-30 16:15:30 -07:00 committed by Ben McIlwain
parent 6785ce277a
commit 3613eff204
2 changed files with 7 additions and 3 deletions

View file

@ -114,6 +114,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
LeaseOptions.Builder.withCountLimit(maxLeaseCount()).leasePeriod(LEASE_MINUTES, MINUTES);
List<TaskHandle> tasks = queue.leaseTasks(options);
if (tasks.isEmpty()) {
response.setPayload("No contact/host deletion tasks in pull queue.");
return;
}
Multiset<String> kindCounts = HashMultiset.create(2);
@ -143,6 +144,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
ImmutableList<DeletionRequest> deletionRequests = builder.build();
if (deletionRequests.isEmpty()) {
logger.info("No asynchronous deletions to process because all were already handled.");
response.setPayload("All requested deletions of contacts/hosts have already occurred.");
} else {
logger.infofmt(
"Processing asynchronous deletion of %d contacts and %d hosts: %s",