diff --git a/core/src/main/java/google/registry/export/BigqueryPollJobAction.java b/core/src/main/java/google/registry/export/BigqueryPollJobAction.java index e662b23b6..a5a4aebbf 100644 --- a/core/src/main/java/google/registry/export/BigqueryPollJobAction.java +++ b/core/src/main/java/google/registry/export/BigqueryPollJobAction.java @@ -73,8 +73,10 @@ public class BigqueryPollJobAction implements Runnable { @Override public void run() { - checkJobOutcome(); // Throws a NotModifiedException if the job hasn't completed. - if (payload == null || payload.length == 0) { + boolean jobOutcome = + checkJobOutcome(); // Throws a NotModifiedException if the job hasn't completed. + // If the job failed, do not enqueue the next step. + if (!jobOutcome || payload == null || payload.length == 0) { return; } // If there is a payload, it's a chained task, so enqueue it. diff --git a/core/src/test/java/google/registry/export/BigqueryPollJobActionTest.java b/core/src/test/java/google/registry/export/BigqueryPollJobActionTest.java index 998a088d9..add6ce8d0 100644 --- a/core/src/test/java/google/registry/export/BigqueryPollJobActionTest.java +++ b/core/src/test/java/google/registry/export/BigqueryPollJobActionTest.java @@ -17,6 +17,7 @@ package google.registry.export; import static com.google.appengine.api.taskqueue.QueueFactory.getQueue; import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.truth.Truth.assertThat; +import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TestLogHandlerUtils.assertLogMessage; import static java.nio.charset.StandardCharsets.UTF_8; @@ -174,6 +175,7 @@ public class BigqueryPollJobActionTest { action.run(); assertLogMessage( logHandler, SEVERE, String.format("Bigquery job failed - %s:%s", PROJECT_ID, JOB_ID)); + assertNoTasksEnqueued(CHAINED_QUEUE_NAME); } @Test