Skip to content

Commit d24ddaf

Browse files
committed
Update FinalizeOrder
1 parent a2d007a commit d24ddaf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

sa/sa.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,14 @@ func (ssa *SQLStorageAuthority) FinalizeOrder(ctx context.Context, req *sapb.Fin
897897
if req.Id == 0 || req.CertificateSerial == "" {
898898
return nil, errIncompleteRequest
899899
}
900+
901+
query := `UPDATE orders SET certificateSerial = ? WHERE id = ? AND beganProcessing = true`
902+
if features.Get().WriteNewOrderSchema && looksLikeRandomID(req.Id, ssa.clk.Now()) {
903+
query = `UPDATE orders2 SET certificateSerial = ? WHERE id = ? AND beganProcessing = true`
904+
}
905+
900906
_, overallError := db.WithTransaction(ctx, ssa.dbMap, func(tx db.Executor) (interface{}, error) {
901-
result, err := tx.ExecContext(ctx, `
902-
UPDATE orders
903-
SET certificateSerial = ?
904-
WHERE id = ? AND
905-
beganProcessing = true`,
906-
req.CertificateSerial,
907-
req.Id)
907+
result, err := tx.ExecContext(ctx, query, req.CertificateSerial, req.Id)
908908
if err != nil {
909909
return nil, berrors.InternalServerError("error updating order for finalization")
910910
}
@@ -931,6 +931,7 @@ func (ssa *SQLStorageAuthority) FinalizeOrder(ctx context.Context, req *sapb.Fin
931931
if overallError != nil {
932932
return nil, overallError
933933
}
934+
934935
return &emptypb.Empty{}, nil
935936
}
936937

0 commit comments

Comments
 (0)