Fixes for New() methods

This commit is contained in:
Jason Streifling 2024-03-05 15:53:59 +01:00
parent 88b3d7e159
commit 7d49b2cb25
2 changed files with 14 additions and 10 deletions

View File

@ -57,10 +57,6 @@ func initChannel() *Channel {
LastBuildDate: now, LastBuildDate: now,
} }
channel.wg.Add(1)
go channel.start()
channel.wg.Wait()
return channel return channel
} }
@ -92,7 +88,13 @@ func (c *Channel) check() error {
} }
func NewChannel() *Channel { func NewChannel() *Channel {
return initChannel() channel := initChannel()
channel.wg.Add(1)
go channel.start()
channel.wg.Wait()
return channel
} }
func (c *Channel) AddCategory(category string) { func (c *Channel) AddCategory(category string) {

12
item.go
View File

@ -43,10 +43,6 @@ func initItem() *Item {
PubDate: time.Now().Format(time.RFC1123Z), PubDate: time.Now().Format(time.RFC1123Z),
} }
item.wg.Add(1)
go item.start()
item.wg.Wait()
return item return item
} }
@ -66,7 +62,13 @@ func (i *Item) check() error {
} }
func NewItem() *Item { func NewItem() *Item {
return initItem() item := initItem()
item.wg.Add(1)
go item.start()
item.wg.Wait()
return item
} }
func (i *Item) AddCategory(category string) { func (i *Item) AddCategory(category string) {