mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Batch NORDN pull queue task deletions
They were failing because the maximum App Engine task batch size is 1,000, and we currently have more than 4,000 tasks in the pull queue. We keep re-uploading those to NORDN because we're unable to delete the tasks after successful upload, so the leases expire and they get processed again. Also renames TaskEnqueuer to TaskQueueUtils to reflect its newly expanded role. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=197060903
This commit is contained in:
parent
1248a7722b
commit
c989911526
21 changed files with 129 additions and 73 deletions
|
@ -33,7 +33,7 @@ import google.registry.request.HttpException.NotModifiedException;
|
|||
import google.registry.request.Payload;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.util.TaskEnqueuer;
|
||||
import google.registry.util.TaskQueueUtils;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -64,7 +64,7 @@ public class BigqueryPollJobAction implements Runnable {
|
|||
static final Duration POLL_COUNTDOWN = Duration.standardSeconds(20);
|
||||
|
||||
@Inject Bigquery bigquery;
|
||||
@Inject TaskEnqueuer enqueuer;
|
||||
@Inject TaskQueueUtils taskQueueUtils;
|
||||
@Inject @Header(CHAINED_TASK_QUEUE_HEADER) Lazy<String> chainedQueueName;
|
||||
@Inject @Header(PROJECT_ID_HEADER) String projectId;
|
||||
@Inject @Header(JOB_ID_HEADER) String jobId;
|
||||
|
@ -84,7 +84,7 @@ public class BigqueryPollJobAction implements Runnable {
|
|||
} catch (ClassNotFoundException | IOException e) {
|
||||
throw new BadRequestException("Cannot deserialize task from payload", e);
|
||||
}
|
||||
String taskName = enqueuer.enqueue(getQueue(chainedQueueName.get()), task).getName();
|
||||
String taskName = taskQueueUtils.enqueue(getQueue(chainedQueueName.get()), task).getName();
|
||||
logger.infofmt(
|
||||
"Added chained task %s for %s to queue %s: %s",
|
||||
taskName,
|
||||
|
@ -127,16 +127,17 @@ public class BigqueryPollJobAction implements Runnable {
|
|||
/** Helper class to enqueue a bigquery poll job. */
|
||||
public static class BigqueryPollJobEnqueuer {
|
||||
|
||||
private final TaskEnqueuer enqueuer;
|
||||
private final TaskQueueUtils taskQueueUtils;
|
||||
|
||||
@Inject
|
||||
BigqueryPollJobEnqueuer(TaskEnqueuer enqueuer) {
|
||||
this.enqueuer = enqueuer;
|
||||
BigqueryPollJobEnqueuer(TaskQueueUtils taskQueueUtils) {
|
||||
this.taskQueueUtils = taskQueueUtils;
|
||||
}
|
||||
|
||||
/** Enqueue a task to poll for the success or failure of the referenced BigQuery job. */
|
||||
public TaskHandle enqueuePollTask(JobReference jobRef) {
|
||||
return enqueuer.enqueue(getQueue(QUEUE), createCommonPollTask(jobRef).method(Method.GET));
|
||||
return taskQueueUtils.enqueue(
|
||||
getQueue(QUEUE), createCommonPollTask(jobRef).method(Method.GET));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +149,7 @@ public class BigqueryPollJobAction implements Runnable {
|
|||
// Serialize the chainedTask into a byte array to put in the task payload.
|
||||
ByteArrayOutputStream taskBytes = new ByteArrayOutputStream();
|
||||
new ObjectOutputStream(taskBytes).writeObject(chainedTask);
|
||||
return enqueuer.enqueue(
|
||||
return taskQueueUtils.enqueue(
|
||||
getQueue(QUEUE),
|
||||
createCommonPollTask(jobRef)
|
||||
.method(Method.POST)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue