diff --git a/internal/platform/postgres/test_publications.go b/internal/platform/postgres/test_publications.go index 771888b..d44afb0 100644 --- a/internal/platform/postgres/test_publications.go +++ b/internal/platform/postgres/test_publications.go @@ -273,8 +273,8 @@ WITH updated AS ( max_attempts, idempotency_key, created_at, updated_at ) SELECT 'job-' || substring(md5($1 || '#test.poll#' || updated.retry_count || '#1') from 1 for 32), - 'test.poll', $4::jsonb, 'pending', $5, $6, $7, - 'test-poll:' || $1 || ':' || updated.retry_count || ':1', $3, $3 + 'test.poll', $5::jsonb, 'pending', $6, $7, $8, + 'test-poll:' || $1 || ':' || updated.retry_count || ':1', $4, $4 FROM updated ON CONFLICT (idempotency_key) DO NOTHING ) diff --git a/internal/workflows/testweknora/upload.go b/internal/workflows/testweknora/upload.go index 7d39feb..b64a380 100644 --- a/internal/workflows/testweknora/upload.go +++ b/internal/workflows/testweknora/upload.go @@ -7,6 +7,7 @@ import ( "encoding/hex" "encoding/json" "errors" + "fmt" "io" "path/filepath" "strings" @@ -123,7 +124,7 @@ func (handler *UploadHandler) Handle(ctx context.Context, job jobs.Job) error { uploadMD5, _ := handler.hashSpool(candidate) now := handler.now() if _, err := handler.store.RecordUploadAndSchedulePoll(ctx, candidate.ID, knowledge.ID, uploadMD5, now, now.Add(handler.firstPollDelay)); err != nil { - return ErrUploadStateConflict + return fmt.Errorf("%w: %v", ErrUploadStateConflict, err) } return nil } @@ -194,7 +195,7 @@ func (handler *UploadHandler) Handle(ctx context.Context, job jobs.Job) error { } now := handler.now() if _, err := handler.store.RecordUploadAndSchedulePoll(ctx, candidate.ID, knowledge.ID, uploadMD5, now, now.Add(handler.firstPollDelay)); err != nil { - return ErrUploadStateConflict + return fmt.Errorf("%w: %v", ErrUploadStateConflict, err) } return nil }