aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/insert_module.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-04-28 00:20:38 -0400
committerJulie Qiu <julieqiu@google.com>2020-04-29 19:17:47 +0000
commit21584e30257c7768c25dbe8a2dec7279ace4f84b (patch)
tree8e5a23d0f852b1f2d8a005f7ba997babada39018 /internal/postgres/insert_module.go
parent346216cc1e61445876f64526c02f74f90b7ec608 (diff)
downloadgo-x-pkgsite-21584e30257c7768c25dbe8a2dec7279ace4f84b.tar.xz
internal/worker: add timings to FetchAndUpdateState
fetchTask.timings is added to time FetchModule and each DB insert. The results are logged as a single log line, which will be exported to BigQuery for analysis as needed. postgres.DeleteModule is rewritten to db.DeleteModule, for consistency with other exported functions from internal/postgres. Change-Id: Id6ecd7fccd238fb17a45554ec033ebf404c1020c Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/729940 Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/postgres/insert_module.go')
-rw-r--r--internal/postgres/insert_module.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/postgres/insert_module.go b/internal/postgres/insert_module.go
index 81213032..796b24c5 100644
--- a/internal/postgres/insert_module.go
+++ b/internal/postgres/insert_module.go
@@ -637,12 +637,12 @@ func removeNonDistributableData(m *internal.Module) {
}
// DeleteModule deletes a Version from the database.
-func DeleteModule(ctx context.Context, db *database.DB, modulePath, version string) (err error) {
+func (db *DB) DeleteModule(ctx context.Context, modulePath, version string) (err error) {
defer derrors.Wrap(&err, "DeleteModule(ctx, db, %q, %q)", modulePath, version)
// We only need to delete from the modules table. Thanks to ON DELETE
// CASCADE constraints, that will trigger deletions from all other tables.
const stmt = `DELETE FROM modules WHERE module_path=$1 AND version=$2`
- _, err = db.Exec(ctx, stmt, modulePath, version)
+ _, err = db.db.Exec(ctx, stmt, modulePath, version)
return err
}