Skip to content

Commit

Permalink
Update UpdatedAt only if its not there already
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed-madi committed Feb 9, 2024
1 parent 7266742 commit 313f371
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@ func CalculateHistory(LogCtx context.Context, invalSeq uint64, invalGrants ch.Ti
currentHistoryForGrant, ok := currentHistory[previousName]
if !ok {
currentHistoryForGrant = GrantHistory{}
currentHistoryForGrant.UpdatedAt = time.Now().Unix()
}

// Add grant to history
currentHistoryForGrant.UpdatedAt = time.Now().Unix()
currentHistoryForGrant.Entries = append(currentHistoryForGrant.Entries, GrantHistorySequencePair{
StartSeq: previousInfo.Sequence,
EndSeq: invalSeq,
Expand Down
2 changes: 2 additions & 0 deletions rest/revocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1406,8 +1406,10 @@ func TestChannelHistoryPruning(t *testing.T) {
aHistory := channelHistory["a"]
aHistory.UpdatedAt = time.Now().Add(-61 * time.Hour * 24).Unix()
channelHistory["a"] = aHistory
t.Log(aHistory)

role.SetChannelHistory(channelHistory)
t.Log("CHANHIST", role.ChannelHistory())
err = authenticator.Save(role)
assert.NoError(t, err)

Expand Down

0 comments on commit 313f371

Please sign in to comment.