sdk: automatically store replaceable events since we already check the local store for them.
This commit is contained in:
@@ -124,6 +124,8 @@ func (sys *System) FetchProfileMetadata(ctx context.Context, pubkey nostr.PubKey
|
||||
newM := sys.tryFetchMetadataFromNetwork(ctx, pubkey)
|
||||
if newM != nil && newM.Event.CreatedAt > pm.Event.CreatedAt {
|
||||
pm = *newM
|
||||
|
||||
sys.Store.ReplaceEvent(*pm.Event)
|
||||
}
|
||||
|
||||
// even if we didn't find anything register this because we tried
|
||||
@@ -140,6 +142,8 @@ func (sys *System) FetchProfileMetadata(ctx context.Context, pubkey nostr.PubKey
|
||||
if newM := sys.tryFetchMetadataFromNetwork(ctx, pubkey); newM != nil {
|
||||
pm = *newM
|
||||
|
||||
sys.Store.SaveEvent(*pm.Event)
|
||||
|
||||
// we'll only save this if we got something which means we found at least one event
|
||||
lastFetchKey := makeLastFetchKey(0, pubkey)
|
||||
sys.KVStore.Set(lastFetchKey, encodeTimestamp(nostr.Now()))
|
||||
|
||||
Reference in New Issue
Block a user