Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d76b6ac

Browse files
author
Matthew Barnes
committedDec 4, 2024·
backend: Fix nil pointer dereference
Don't count on OperationID being set in OperationDocuments. Implicit async operations will not have this field set. Get the subscription ID from ExternalID instead.
1 parent 353d9e9 commit d76b6ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎backend/operations_scanner.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (s *OperationsScanner) pollClusterOperation(ctx context.Context, logger *sl
165165
if err != nil {
166166
var ocmError *ocmerrors.Error
167167
if errors.As(err, &ocmError) && ocmError.Status() == http.StatusNotFound && doc.Request == database.OperationRequestDelete {
168-
err = s.withSubscriptionLock(ctx, logger, doc.OperationID.SubscriptionID, func(ctx context.Context) error {
168+
err = s.withSubscriptionLock(ctx, logger, doc.ExternalID.SubscriptionID, func(ctx context.Context) error {
169169
return s.deleteOperationCompleted(ctx, logger, doc)
170170
})
171171
if err == nil {
@@ -180,7 +180,7 @@ func (s *OperationsScanner) pollClusterOperation(ctx context.Context, logger *sl
180180
logger.Warn(err.Error())
181181
err = nil
182182
} else {
183-
err = s.withSubscriptionLock(ctx, logger, doc.OperationID.SubscriptionID, func(ctx context.Context) error {
183+
err = s.withSubscriptionLock(ctx, logger, doc.ExternalID.SubscriptionID, func(ctx context.Context) error {
184184
return s.updateOperationStatus(ctx, logger, doc, opStatus, opError)
185185
})
186186
}

0 commit comments

Comments
 (0)
Please sign in to comment.