10 playlist download (#71)
* leveraging message queue for playlist entries DL * playlist support implemented It's a little bit slow but solid enough :D
This commit is contained in:
@@ -30,7 +30,15 @@ func NewMessageQueue() *MessageQueue {
|
||||
|
||||
// Publish a message to the queue and set the task to a peding state.
|
||||
func (m *MessageQueue) Publish(p *Process) {
|
||||
go p.SetPending()
|
||||
p.SetPending()
|
||||
go p.SetMetadata()
|
||||
m.producerCh <- p
|
||||
}
|
||||
|
||||
// Publish a message to the queue and set the task to a peding state.
|
||||
// ENSURE P IS PART OF A PLAYLIST
|
||||
// Needs a further review
|
||||
func (m *MessageQueue) PublishPlaylistEntry(p *Process) {
|
||||
m.producerCh <- p
|
||||
}
|
||||
|
||||
@@ -45,3 +53,13 @@ func (m *MessageQueue) Subscriber() {
|
||||
}(msg)
|
||||
}
|
||||
}
|
||||
|
||||
// Empties the message queue
|
||||
func (m *MessageQueue) Empty() {
|
||||
for range m.producerCh {
|
||||
<-m.producerCh
|
||||
}
|
||||
for range m.consumerCh {
|
||||
<-m.consumerCh
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user