Movatterモバイル変換


[0]ホーム

URL:


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

Commitb7d64db

Browse files
committed
improve clarity
1 parent84d9556 commitb7d64db

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎coderd/cryptokeys/dbkeycache.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,19 @@ func (d *DBKeyCache) Version(ctx context.Context, sequence int32) (database.Cryp
9898

9999
func (d*DBKeyCache)Latest(ctx context.Context) (database.CryptoKey,error) {
100100
d.cacheMu.RLock()
101+
latest:=d.latestKey
102+
d.cacheMu.RUnlock()
103+
101104
now:=d.Clock.Now().UTC()
102-
ifd.latestKey.IsActive(now) {
103-
d.cacheMu.RUnlock()
104-
returnd.latestKey,nil
105+
iflatest.IsActive(now) {
106+
returnlatest,nil
105107
}
106-
d.cacheMu.RUnlock()
107108

108109
d.cacheMu.Lock()
109110
deferd.cacheMu.Unlock()
110111

111-
ifd.latestKey.IsActive(now) {
112-
returnd.latestKey,nil
112+
iflatest.IsActive(now) {
113+
returnlatest,nil
113114
}
114115

115116
cache,latest,err:=d.newCache(ctx)
@@ -153,6 +154,7 @@ func (d *DBKeyCache) newCache(ctx context.Context) (map[int32]database.CryptoKey
153154
}
154155
cache:=toMap(keys)
155156
varlatest database.CryptoKey
157+
// Keys are returned in order from highest sequence to lowest.
156158
for_,key:=rangekeys {
157159
if!key.IsActive(now) {
158160
continue

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp