From c6a45f654cf27919dcb84f8cb7d8f52b13c15289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Fri, 1 Dec 2023 16:33:16 +0100 Subject: [PATCH 1/2] Add outcome and event for retrying postprocessing steps --- pkg/events/postprocessing.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/events/postprocessing.go b/pkg/events/postprocessing.go index c6ab698321..cd52a6356d 100644 --- a/pkg/events/postprocessing.go +++ b/pkg/events/postprocessing.go @@ -49,6 +49,8 @@ var ( PPOutcomeAbort PostprocessingOutcome = "abort" // PPOutcomeContinue means that the upload is moved to its final destination (eventually being marked with pp results) PPOutcomeContinue PostprocessingOutcome = "continue" + // PPOutcomeRetry means that there was a temporary issue and the postprocessing should be retried at a later point in time + PPOutcomeRetry PostprocessingOutcome = "retry" ) // BytesReceived is emitted by the server when it received all bytes of an upload @@ -153,6 +155,22 @@ func (PostprocessingFinished) Unmarshal(v []byte) (interface{}, error) { return e, err } +// PostprocessingRetry is emitted by *some* service which can decide that +type PostprocessingRetry struct { + UploadID string + Filename string + ExecutingUser *user.User + Failures int + BackoffDuration time.Duration +} + +// Unmarshal to fulfill umarshaller interface +func (PostprocessingRetry) Unmarshal(v []byte) (interface{}, error) { + e := PostprocessingRetry{} + err := json.Unmarshal(v, &e) + return e, err +} + // UploadReady is emitted by the storage provider when postprocessing is finished type UploadReady struct { UploadID string From daac09a58f83715207fe3d2fec5d932007881297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Mon, 4 Dec 2023 10:04:19 +0100 Subject: [PATCH 2/2] Add changelog --- changelog/unreleased/add-retry-pp-outcome.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/add-retry-pp-outcome.md diff --git a/changelog/unreleased/add-retry-pp-outcome.md b/changelog/unreleased/add-retry-pp-outcome.md new file mode 100644 index 0000000000..1ec37f746a --- /dev/null +++ b/changelog/unreleased/add-retry-pp-outcome.md @@ -0,0 +1,5 @@ +Enhancement: Add a retry postprocessing outcome and event + +We added a retry postprocessing outcome and event. This enhancement provides the ability to handle retry scenarios during postprocessing. + +https://github.com/cs3org/reva/pull/4384 \ No newline at end of file