Skip to content

Commit b39a7ee

Browse files
- Refine await.
1 parent a8b256f commit b39a7ee

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

internal/stackql/execution/mono_valent_execution.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ type monoValentExecution struct {
7878
isReadOnly bool //nolint:unused // TODO: build out
7979
isSkipResponse bool
8080
isMutation bool
81+
isAwait bool
8182
}
8283

8384
func NewMonoValentExecutorFactory(
@@ -90,6 +91,7 @@ func NewMonoValentExecutorFactory(
9091
stream streaming.MapStream,
9192
isSkipResponse bool,
9293
isMutation bool,
94+
isAwait bool,
9395
) MonoValentExecutorFactory {
9496
var tcc internaldto.TxnControlCounters
9597
if insertCtx != nil {
@@ -110,6 +112,7 @@ func NewMonoValentExecutorFactory(
110112
stream: stream,
111113
isSkipResponse: isSkipResponse,
112114
isMutation: isMutation,
115+
isAwait: isAwait,
113116
}
114117
}
115118

@@ -586,6 +589,7 @@ type AgnosticatePayload interface {
586589
GetInsertPreparator() InsertPreparator
587590
IsSkipResponse() bool
588591
IsMutation() bool
592+
IsAwait() bool
589593
}
590594

591595
type httpAgnosticatePayload struct {
@@ -604,6 +608,7 @@ type httpAgnosticatePayload struct {
604608
insertPreparator InsertPreparator
605609
isSkipResponse bool
606610
isMutation bool
611+
isAwait bool
607612
}
608613

609614
func newHTTPAgnosticatePayload(
@@ -622,6 +627,7 @@ func newHTTPAgnosticatePayload(
622627
insertPreparator InsertPreparator,
623628
isSkipResponse bool,
624629
isMutation bool,
630+
isAwait bool,
625631
) AgnosticatePayload {
626632
return &httpAgnosticatePayload{
627633
tableMeta: tableMeta,
@@ -639,13 +645,18 @@ func newHTTPAgnosticatePayload(
639645
insertPreparator: insertPreparator,
640646
isSkipResponse: isSkipResponse,
641647
isMutation: isMutation,
648+
isAwait: isAwait,
642649
}
643650
}
644651

645652
func (ap *httpAgnosticatePayload) GetPolyHandler() PolyHandler {
646653
return ap.polyHandler
647654
}
648655

656+
func (ap *httpAgnosticatePayload) IsAwait() bool {
657+
return ap.isAwait
658+
}
659+
649660
func (ap *httpAgnosticatePayload) GetInsertPreparator() InsertPreparator {
650661
return ap.insertPreparator
651662
}
@@ -748,6 +759,7 @@ func agnosticate(
748759
insertPreparator := agPayload.GetInsertPreparator()
749760
isSkipResponse := agPayload.IsNilResponseAcceptable()
750761
isMutation := agPayload.IsMutation()
762+
isAwait := agPayload.IsAwait()
751763
// TODO: TCC setup
752764
armoury, armouryErr := agPayload.GetArmoury()
753765
if armouryErr != nil {
@@ -797,7 +809,7 @@ func agnosticate(
797809
insertPreparator,
798810
isSkipResponse,
799811
false,
800-
false,
812+
isAwait,
801813
false,
802814
isMutation,
803815
"",
@@ -1193,7 +1205,7 @@ func (sp *standardProcessor) Process() ProcessorResponse {
11931205
)
11941206
housekeepingDone = insertPrepResult.IsHousekeepingDone()
11951207
insertPrepErr, hasInsertPrepErr := insertPrepResult.GetError()
1196-
if isSkipResponse && isMutation && httpResponse.StatusCode < 300 {
1208+
if !isAwait && isSkipResponse && isMutation && httpResponse.StatusCode < 300 {
11971209
return newHTTPProcessorResponse(
11981210
nil, reversalStream, false, nil,
11991211
).WithSuccessMessages([]string{"The operation was despatched successfully"})
@@ -1388,6 +1400,7 @@ func (mv *monoValentExecution) GetExecutor() (func(pc primitive.IPrimitiveCtx) i
13881400
mv,
13891401
mv.isSkipResponse,
13901402
mv.isMutation,
1403+
mv.isAwait,
13911404
)
13921405
processorResponse, agnosticErr := agnosticate(agnosticatePayload)
13931406
if agnosticErr != nil {

internal/stackql/primitivebuilder/delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func (ss *Delete) Build() error {
8080
streaming.NewNopMapStream(),
8181
!ss.isAwait,
8282
true,
83+
ss.isAwait,
8384
)
8485
ex, exErr := mvb.GetExecutor()
8586
if exErr != nil {

internal/stackql/primitivebuilder/mono_valent_builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func newMonoValentBuilder(
7272
stream,
7373
isSkipResponse,
7474
isMutation,
75+
false,
7576
),
7677
}
7778
}

0 commit comments

Comments
 (0)