fix: remove check if source exists
All checks were successful
Gitea Build Check / Build (push) Successful in 9m47s

This commit is contained in:
SoXX 2024-07-08 21:08:37 +02:00
parent 521c11ee2e
commit 0b800ff423

View File

@ -38,19 +38,12 @@ func NewPlug(ctx context.Context, address string, port string, source models.Sou
func (p *Plug) Listen() error { func (p *Plug) Listen() error {
var err error var err error
plugSource, err := p.database.GetSourceByDomain(p.ctx, models.AnthroveSourceDomain(p.source.Domain)) log.Printf("initilazing source!")
err = p.database.CreateSource(p.ctx, &p.source)
if err != nil { if err != nil {
return err return err
} }
if plugSource == nil {
log.Printf("no source found for domain %s, initilazing source!", p.source.Domain)
err := p.database.CreateSource(p.ctx, &p.source)
if err != nil {
return err
}
}
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", p.address, p.port)) lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", p.address, p.port))
if err != nil { if err != nil {
return err return err