feat(ui): add Now Playing panel for admins (#4209)
* feat(ui): add Now Playing panel and integrate now playing count updates Signed-off-by: Deluan <deluan@navidrome.org> * fix: check return value in test to satisfy linter * fix: format React code with prettier * fix: resolve race condition in play tracker test * fix: log error when fetching now playing data fails Signed-off-by: Deluan <deluan@navidrome.org> * feat(ui): refactor Now Playing panel with new components and error handling Signed-off-by: Deluan <deluan@navidrome.org> * fix(ui): adjust padding and height in Now Playing panel for improved layout Signed-off-by: Deluan <deluan@navidrome.org> * fix(cache): add automatic cleanup to prevent goroutine leak on cache garbage collection Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Vendored
+14
@@ -143,5 +143,19 @@ var _ = Describe("SimpleCache", func() {
|
||||
Expect(cache.Get("key0")).To(Equal("value0"))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("OnExpiration", func() {
|
||||
It("should call callback when item expires", func() {
|
||||
cache = NewSimpleCache[string, string]()
|
||||
expired := make(chan struct{})
|
||||
cache.OnExpiration(func(k, v string) { close(expired) })
|
||||
Expect(cache.AddWithTTL("key", "value", 10*time.Millisecond)).To(Succeed())
|
||||
select {
|
||||
case <-expired:
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
Fail("expiration callback not called")
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user