From 24bfdfd253e088b841478ac459a0fe6e2cafa8c4 Mon Sep 17 00:00:00 2001 From: Robi9 Date: Mon, 21 Oct 2024 16:40:22 -0300 Subject: [PATCH] Adjust urn update --- backends/rapidpro/contact.go | 2 +- backends/rapidpro/urn.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backends/rapidpro/contact.go b/backends/rapidpro/contact.go index dbe3f33f..c2544c7f 100644 --- a/backends/rapidpro/contact.go +++ b/backends/rapidpro/contact.go @@ -133,7 +133,7 @@ func contactForURNTeams(ctx context.Context, b *backend, urn urns.URN, org OrgID return contact, err } - err = updateContactTeamsURN(b.db, contact.URNID_, urn.Identity().String()) + err = updateContactTeamsURN(ctx, b.db, contact.URNID_, urn.Identity().String()) if err != nil { logrus.WithError(err).WithField("urn", urn.Identity()).WithField("org_id", org).Error("error updating contact urn") return contact, err diff --git a/backends/rapidpro/urn.go b/backends/rapidpro/urn.go index f65aae08..ff66b87a 100644 --- a/backends/rapidpro/urn.go +++ b/backends/rapidpro/urn.go @@ -1,6 +1,7 @@ package rapidpro import ( + "context" "database/sql" "database/sql/driver" "fmt" @@ -333,8 +334,8 @@ func fullyUpdateContactURN(db *sqlx.Tx, urn *DBContactURN) error { return err } -func updateContactTeamsURN(db *sqlx.DB, urnID ContactURNID, newURN string) error { - _, err := db.Exec(updateTeamsURN, newURN, urnID) +func updateContactTeamsURN(ctx context.Context, db *sqlx.DB, urnID ContactURNID, newURN string) error { + _, err := db.ExecContext(ctx, updateTeamsURN, newURN, urnID) if err != nil { logrus.WithError(err).WithField("urn_id", urnID).Error("error updating contact urn") return err