code refactoring

This commit is contained in:
2024-08-20 20:29:32 +02:00
parent c51f320a6f
commit 8f2d9eaf6e
6 changed files with 20 additions and 17 deletions

View File

@@ -167,8 +167,9 @@ func (l *LiveStream) monitorStartTime(r io.Reader, doneWait chan struct{}) {
waitTimeScanner()
}
l.status = inProgress
}
l.status = inProgress
}
func (l *LiveStream) WaitTime() <-chan time.Duration {

View File

@@ -53,7 +53,6 @@ func (m *MessageQueue) downloadConsumer() {
sem := semaphore.NewWeighted(int64(m.concurrency))
m.eventBus.SubscribeAsync(queueName, func(p *Process) {
//TODO: provide valid context
sem.Acquire(context.Background(), 1)
defer sem.Release(1)
@@ -82,8 +81,7 @@ func (m *MessageQueue) metadataSubscriber() {
sem := semaphore.NewWeighted(1)
m.eventBus.SubscribeAsync(queueName, func(p *Process) {
//TODO: provide valid context
sem.Acquire(context.TODO(), 1)
sem.Acquire(context.Background(), 1)
defer sem.Release(1)
slog.Info("received process from event bus",

View File

@@ -69,7 +69,7 @@ func PlaylistDetect(req DownloadRequest, mq *MessageQueue, db *MemoryDB) error {
1,
)
//TODO: it's idiotic but it works: virtually delay the creation time
//XXX: it's idiotic but it works: virtually delay the creation time
meta.CreatedAt = time.Now().Add(time.Millisecond * time.Duration(i*10))
proc := &Process{