diff --git a/platform/start.go b/platform/start.go index 81c86007..6f719d28 100644 --- a/platform/start.go +++ b/platform/start.go @@ -7,24 +7,19 @@ import ( "sync" "time" - //"github.com/Gleipnir-Technology/bob/dialect/psql" - //"github.com/Gleipnir-Technology/bob/dialect/psql/sm" + "github.com/rs/zerolog/log" + bobpgx "github.com/stephenafamo/bob/drivers/pgx" + commsemail "source.gleipnir.technology/Gleipnir/nidus-sync/comms/email" "source.gleipnir.technology/Gleipnir/nidus-sync/config" "source.gleipnir.technology/Gleipnir/nidus-sync/db" "source.gleipnir.technology/Gleipnir/nidus-sync/db/enums" "source.gleipnir.technology/Gleipnir/nidus-sync/db/models" - //"source.gleipnir.technology/Gleipnir/nidus-sync/platform/background" - commsemail "source.gleipnir.technology/Gleipnir/nidus-sync/comms/email" "source.gleipnir.technology/Gleipnir/nidus-sync/platform/csv" platformemail "source.gleipnir.technology/Gleipnir/nidus-sync/platform/email" "source.gleipnir.technology/Gleipnir/nidus-sync/platform/file" "source.gleipnir.technology/Gleipnir/nidus-sync/platform/geocode" "source.gleipnir.technology/Gleipnir/nidus-sync/platform/mailer" "source.gleipnir.technology/Gleipnir/nidus-sync/platform/text" - //"source.gleipnir.technology/Gleipnir/nidus-sync/userfile" - //"github.com/google/uuid" - "github.com/rs/zerolog/log" - bobpgx "github.com/stephenafamo/bob/drivers/pgx" ) var waitGroup sync.WaitGroup diff --git a/platform/text/text.go b/platform/text/text.go index deeaa920..45d5dde5 100644 --- a/platform/text/text.go +++ b/platform/text/text.go @@ -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