Commit DB transaction after responding
This commit is contained in:
parent
393836a86a
commit
5d03ab0844
2 changed files with 7 additions and 8 deletions
|
|
@ -104,6 +104,7 @@ func respondText(ctx context.Context, log_id int32) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("send response: %w", err)
|
||||
}
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error { return txn.Commit(ctx) }, ctx, "commit after confirm")
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error {
|
||||
return handleWaitingTextJobs(ctx, *src)
|
||||
}, ctx, "handle waiting text jobs")
|
||||
|
|
@ -130,6 +131,7 @@ func respondText(ctx context.Context, log_id int32) error {
|
|||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to send unsubscribe acknowledgement.")
|
||||
}
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error { return txn.Commit(ctx) }, ctx, "commit after confirm")
|
||||
return nil
|
||||
case "reset conversation":
|
||||
err = handleResetConversation(ctx, txn, *src)
|
||||
|
|
@ -141,6 +143,7 @@ func respondText(ctx context.Context, log_id int32) error {
|
|||
}, ctx, "send text command response")
|
||||
return fmt.Errorf("reset conversation: %w", err)
|
||||
}
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error { return txn.Commit(ctx) }, ctx, "commit after confirm")
|
||||
return nil
|
||||
}
|
||||
// If we've got an open public report from this phone number then we'll let the district respond
|
||||
|
|
@ -166,6 +169,7 @@ func respondText(ctx context.Context, log_id int32) error {
|
|||
}
|
||||
event.Updated(event.TypeRMOPublicReport, report.OrganizationID, report.PublicID)
|
||||
}
|
||||
lint.LogOnErrCtx(func(ctx context.Context) error { return txn.Commit(ctx) }, ctx, "commit after confirm")
|
||||
// If humans are involved, wait for them.
|
||||
if len(reports) > 0 {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue