sdk: eliminate all the data races go was complaining about.

This commit is contained in:
fiatjaf
2026-01-27 23:25:34 -03:00
parent ca3730e508
commit d87066c9b9
9 changed files with 142 additions and 90 deletions
+3 -2
View File
@@ -31,14 +31,15 @@ func (db *HintDB) Save(pubkey nostr.PubKey, relay string, key hints.HintKey, ts
ts = now
}
db.Lock()
defer db.Unlock()
relayIndex := slices.Index(db.RelayBySerial, relay)
if relayIndex == -1 {
relayIndex = len(db.RelayBySerial)
db.RelayBySerial = append(db.RelayBySerial, relay)
}
db.Lock()
defer db.Unlock()
// fmt.Println(" ", relay, "index", relayIndex, "--", "adding", hints.HintKey(key).String(), ts)
entries, _ := db.OrderedRelaysByPubKey[pubkey]