From fdb8436feabf92bd16e27ea13ac4da5e9fc87195 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 24 Mar 2023 15:09:42 +0100 Subject: dashboard: use more compact keys for SubsystemReport Serialization of CreatedTime doesn't really work. Datastore seems to cut the precision, so we're unable to fully reconstruct the key. Convert the time to UTC before constructing the key. Improve error logging. --- dashboard/app/reporting_lists.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dashboard/app/reporting_lists.go b/dashboard/app/reporting_lists.go index 574336af5..102401b2b 100644 --- a/dashboard/app/reporting_lists.go +++ b/dashboard/app/reporting_lists.go @@ -129,7 +129,7 @@ func reportingBugListCommand(c context.Context, cmd *dashapi.BugListUpdate) (str reportKey := subsystemReportKey(c, subsystemKey(c, subsystem), rawReport) report := new(SubsystemReport) if err := db.Get(c, reportKey, report); err != nil { - return err + return fmt.Errorf("failed to query SubsystemReport (%v): %w", reportKey, err) } stage := report.findStage(cmd.ID) if stage.ExtID == "" { @@ -443,7 +443,7 @@ func subsystemKey(c context.Context, s *Subsystem) *db.Key { } func subsystemReportKey(c context.Context, subsystemKey *db.Key, r *SubsystemReport) *db.Key { - return db.NewKey(c, "SubsystemReport", fmt.Sprintf("%v", r.Created), 0, subsystemKey) + return db.NewKey(c, "SubsystemReport", r.Created.UTC().Format(time.RFC822), 0, subsystemKey) } type subsystemsRegistry struct { -- cgit mrf-deployment