delete peer cache fix
continuous-integration/drone/push Build is failing

This commit is contained in:
yc
2026-04-18 20:40:23 +02:00
parent 00e4e6b046
commit a5dd6cd73f
2 changed files with 8 additions and 1 deletions
+3
View File
@@ -426,6 +426,9 @@ func (id *Identity) GetRequestJobs() []RequestsJob {
} }
func (id *Identity) SaveBackgroundJob() error { func (id *Identity) SaveBackgroundJob() error {
if id.RootKp == nil {
return errors.New("identity not fully initialized: RootKp is nil")
}
var bj BackgroundJob var bj BackgroundJob
bj.Jobs = id.GetRequestJobs() bj.Jobs = id.GetRequestJobs()
bj.RootPublic = id.RootKp.Public bj.RootPublic = id.RootKp.Public
+5 -1
View File
@@ -109,9 +109,13 @@ func (ps *PeerStorage) DeletePeer(uid string) error {
defer ps.close() defer ps.close()
shakey := sha256.Sum256([]byte(uid)) shakey := sha256.Sum256([]byte(uid))
key := shakey[:] key := shakey[:]
return ps.db.Update(func(txn *badger.Txn) error { err = ps.db.Update(func(txn *badger.Txn) error {
return txn.Delete(key) return txn.Delete(key)
}) })
if err == nil {
delete(ps.cache, uid)
}
return err
} }
// LoadPeers function loads Peers from the badger database with a specific password // LoadPeers function loads Peers from the badger database with a specific password