mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Move invoice generation to billing bucket and improve emailing
This moves the new pipeline's invoice generation to the billing bucket, under the 'invoices/yyyy-MM' subdirectory. This also changes the invoice e-mail to use a multipart message that attaches the invoice to the e-mail, to guarantee the correct MIME type and download. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181746191
This commit is contained in:
parent
5726f1dc4e
commit
a42f18798e
16 changed files with 477 additions and 133 deletions
|
@ -108,16 +108,6 @@ public class Retrier implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private static final FailureReporter LOGGING_FAILURE_REPORTER = new FailureReporter() {
|
||||
@Override
|
||||
public void beforeRetry(Throwable thrown, int failures, int maxAttempts) {
|
||||
logger.infofmt(thrown, "Retrying transient error, attempt %d", failures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterFinalFailure(Throwable thrown, int failures) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Retries a unit of work in the face of transient errors and returns the result.
|
||||
*
|
||||
|
@ -136,23 +126,20 @@ public class Retrier implements Serializable {
|
|||
Callable<V> callable,
|
||||
Class<? extends Throwable> retryableError,
|
||||
Class<? extends Throwable>... moreRetryableErrors) {
|
||||
return callWithRetry(
|
||||
callable,
|
||||
LOGGING_FAILURE_REPORTER,
|
||||
retryableError,
|
||||
moreRetryableErrors);
|
||||
return callWithRetry(callable, LOGGING_FAILURE_REPORTER, retryableError, moreRetryableErrors);
|
||||
}
|
||||
|
||||
/** Retries a unit of work in the face of transient errors. */
|
||||
/**
|
||||
* Retries a unit of work in the face of transient errors, without returning a value.
|
||||
*
|
||||
* @see #callWithRetry(Callable, Class, Class[])
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final void callWithRetry(
|
||||
VoidCallable callable,
|
||||
Class<? extends Throwable> retryableError,
|
||||
Class<? extends Throwable>... moreRetryableErrors) {
|
||||
callWithRetry(
|
||||
callable.asCallable(),
|
||||
retryableError,
|
||||
moreRetryableErrors);
|
||||
callWithRetry(callable.asCallable(), retryableError, moreRetryableErrors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,4 +164,29 @@ public class Retrier implements Serializable {
|
|||
return callWithRetry(
|
||||
callable, failureReporter, e -> retryables.stream().anyMatch(supertypeOf(e.getClass())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retries a unit of work in the face of transient errors, without returning a value.
|
||||
*
|
||||
* @see #callWithRetry(Callable, FailureReporter, Class, Class[])
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final void callWithRetry(
|
||||
VoidCallable callable,
|
||||
FailureReporter failureReporter,
|
||||
Class<? extends Throwable> retryableError,
|
||||
Class<? extends Throwable>... moreRetryableErrors) {
|
||||
callWithRetry(callable.asCallable(), failureReporter, retryableError, moreRetryableErrors);
|
||||
}
|
||||
|
||||
private static final FailureReporter LOGGING_FAILURE_REPORTER =
|
||||
new FailureReporter() {
|
||||
@Override
|
||||
public void beforeRetry(Throwable thrown, int failures, int maxAttempts) {
|
||||
logger.infofmt(thrown, "Retrying transient error, attempt %d", failures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterFinalFailure(Throwable thrown, int failures) {}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue