Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d19cffd

Browse files
agneumNikolayS
authored andcommitted
fix: update DSA format and sessionID in the foreword (platform#260)
1 parent e6c4bc4 commit d19cffd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

‎pkg/bot/command/reset_session.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ func ResetSession(ctx context.Context, cmd *platform.Command, msg *models.Messag
5959
session.CloneConnection = cloneConn.Conn()
6060
}
6161

62+
sessionID := session.PlatformSessionID
63+
if sessionID == "" {
64+
sessionID = clone.ID
65+
}
66+
6267
fwData := &foreword.Content{
63-
SessionID: clone.ID,
68+
SessionID: sessionID,
6469
Duration: time.Duration(clone.Metadata.MaxIdleMinutes) * time.Minute,
6570
AppVersion: appVersion,
6671
Edition: edition,

‎pkg/foreword/foreword.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ Database size: %s
3030
Database state at: %s (%s ago)
3131
` + "```"
3232

33-
// TODO(akartasov): use const from the Database Lab repository.
34-
const dsaFormat = "2006年01月02日 15:04:05 UTC"
35-
3633
// Content defines data for a foreword message.
3734
type Content struct {
3835
Duration time.Duration
@@ -54,7 +51,7 @@ func (f *Content) EnrichForewordInfo(ctx context.Context, db *pgxpool.Pool) erro
5451
return errors.Wrap(err, "failed to retrieve database meta info")
5552
}
5653

57-
dsaTime, err := time.Parse(dsaFormat, f.DSA)
54+
dsaTime, err := time.Parse(time.RFC3339, f.DSA)
5855
if err != nil {
5956
log.Err("failed to parse the 'data state at' timestamp of the database snapshot: ", err)
6057
return nil

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /