chore: misc bug fixes supporting sqlite migration (#517)

This commit is contained in:
Gareth
2024-10-13 17:55:37 -07:00
committed by GitHub
parent 28c31720f2
commit 0daa74f04f
31 changed files with 508 additions and 263 deletions

View File

@@ -2,7 +2,6 @@ package orchestrator
import (
"context"
"crypto/rand"
"errors"
"fmt"
"io"
@@ -14,6 +13,7 @@ import (
"github.com/garethgeorge/backrest/internal/orchestrator/logging"
"github.com/garethgeorge/backrest/internal/orchestrator/repo"
"github.com/garethgeorge/backrest/internal/orchestrator/tasks"
"github.com/google/uuid"
"go.uber.org/zap"
)
@@ -160,11 +160,7 @@ func (t *taskRunnerImpl) Logger(ctx context.Context) *zap.Logger {
}
func (t *taskRunnerImpl) LogrefWriter() (string, io.WriteCloser, error) {
randBytes := make([]byte, 8)
if _, err := rand.Read(randBytes); err != nil {
return "", nil, err
}
id := fmt.Sprintf("op%d-logref-%x", t.op.Id, randBytes)
writer, err := t.orchestrator.logStore.Create(id, t.op.GetId(), time.Duration(0))
return id, writer, err
logID := uuid.New().String()
writer, err := t.orchestrator.logStore.Create(logID, t.op.GetId(), time.Duration(0))
return logID, writer, err
}