mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
perf: adopt CachingEventDecoder in Android, Desktop, and amy clients
Passes decoder = CachingEventDecoder() at all four NostrClient construction sites: the Android app pool (AppModules), the Android crawl client (buildCrawlClient — Event Sync / Cashu discovery, the duplicate-heaviest path), the desktop RelayConnectionManager, and amy's Context. Duplicate EVENT frames (14-57% of production traffic) now skip the full JSON re-parse; dispatch semantics unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018saXqYfAa3RvSJoDXK591R
This commit is contained in:
@@ -45,6 +45,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.publishAndConfirmDetailed
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.single.newSubId
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.CachingEventDecoder
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer
|
||||
@@ -115,6 +116,9 @@ class Context(
|
||||
val client: NostrClient =
|
||||
NostrClient(
|
||||
websocketBuilder = BasicOkHttpWebSocket.Builder { okhttp },
|
||||
// Skips re-parsing EVENT frames that arrive again via another
|
||||
// subscription or relay.
|
||||
decoder = CachingEventDecoder(),
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user