From e49d9631bc84c867aad96021901892169360044e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Eduardo=20Jer=C3=A9z=20Gir=C3=B3n?= Date: Wed, 24 Jul 2024 09:31:44 -0600 Subject: [PATCH] Ping S3 client before running execution --- internal/service/executions/run_execution.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/service/executions/run_execution.go b/internal/service/executions/run_execution.go index a5ac4b9..45bfffe 100644 --- a/internal/service/executions/run_execution.go +++ b/internal/service/executions/run_execution.go @@ -40,6 +40,19 @@ func (s *Service) RunExecution(ctx context.Context, backupID uuid.UUID) error { return err } + err = s.ints.S3Client.Ping( + back.DecryptedDestinationAccessKey, back.DecryptedDestinationSecretKey, + back.DestinationRegion, back.DestinationEndpoint, back.DestinationBucketName, + ) + if err != nil { + return updateExec(dbgen.ExecutionsServiceUpdateExecutionParams{ + ID: ex.ID, + Status: sql.NullString{Valid: true, String: "failed"}, + Message: sql.NullString{Valid: true, String: err.Error()}, + FinishedAt: sql.NullTime{Valid: true, Time: time.Now()}, + }) + } + pgVersion, err := s.ints.PGDumpClient.ParseVersion(back.DatabasePgVersion) if err != nil { return updateExec(dbgen.ExecutionsServiceUpdateExecutionParams{