i had been initializing a whole new last.fm/libre.fm client on every now playing request/scrobble, which was unnecessary and clunky. so i now:
- store a
static CLIENT_POOL: LazyLock<DashMap<String, Client>>where the keys are theScrobblerids - get the client for this scrobbler or create a new one and store it. this only runs on new requests, so we don’t unnecessarily create client.
- remove the client when the scrobbler is dropped, e.g. when the config is updated
i’ve never used drop logic before but i think its like the coolest thing ever, so i was excuted about that
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.