Fix timer going awry
This commit is contained in:
@@ -65,10 +65,11 @@ func (a *cacheWarmer) sendWakeSignal() {
|
||||
|
||||
func (a *cacheWarmer) run(ctx context.Context) {
|
||||
for {
|
||||
time.AfterFunc(10*time.Second, func() {
|
||||
t := time.AfterFunc(10*time.Second, func() {
|
||||
a.sendWakeSignal()
|
||||
})
|
||||
<-a.wakeSignal
|
||||
t.Stop()
|
||||
|
||||
// If cache not available, keep waiting
|
||||
if !a.cache.Available(ctx) {
|
||||
|
||||
@@ -27,7 +27,7 @@ var _ = Describe("MediaStreamer", func() {
|
||||
{ID: "123", Path: "tests/fixtures/test.mp3", Suffix: "mp3", BitRate: 128, Duration: 257.0},
|
||||
})
|
||||
testCache := GetTranscodingCache()
|
||||
Eventually(func() bool { return testCache.Ready(context.TODO()) }).Should(BeTrue())
|
||||
Eventually(func() bool { return testCache.Available(context.TODO()) }).Should(BeTrue())
|
||||
})
|
||||
AfterEach(func() {
|
||||
_ = os.RemoveAll(conf.Server.DataFolder)
|
||||
|
||||
@@ -30,7 +30,7 @@ var _ = Describe("MediaStreamer", func() {
|
||||
{ID: "123", Path: "tests/fixtures/test.mp3", Suffix: "mp3", BitRate: 128, Duration: 257.0},
|
||||
})
|
||||
testCache := core.GetTranscodingCache()
|
||||
Eventually(func() bool { return testCache.Ready(context.TODO()) }).Should(BeTrue())
|
||||
Eventually(func() bool { return testCache.Available(context.TODO()) }).Should(BeTrue())
|
||||
streamer = core.NewMediaStreamer(ds, ffmpeg, testCache)
|
||||
})
|
||||
AfterEach(func() {
|
||||
|
||||
Reference in New Issue
Block a user