You are browsing as a guest. Sign up (or log in) to start making projects!

45m 20s logged

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:

  1. store a static CLIENT_POOL: LazyLock<DashMap<String, Client>> where the keys are the Scrobbler ids
  2. 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.
  3. 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

0
3

Comments 0

No comments yet. Be the first!