multiple pipelines
This commit is contained in:
parent
5d125c0ac1
commit
f4c856df68
|
@ -65,6 +65,10 @@ func (p *Pipeline) Process(ctx context.Context, video *model.Video) {
|
||||||
next := p.procs.Next(video)
|
next := p.procs.Next(video)
|
||||||
if next == nil {
|
if next == nil {
|
||||||
p.logger.Info("no more processors for video", slog.String("video", string(video.YoutubeID)))
|
p.logger.Info("no more processors for video", slog.String("video", string(video.YoutubeID)))
|
||||||
|
video.Status = model.StatusReady
|
||||||
|
if err := p.relStorage.Save(video); err != nil {
|
||||||
|
p.logger.Error("failed to save video in rel db", slog.String("video", string(video.YoutubeID)), slog.String("error", err.Error()))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,9 @@ func main() {
|
||||||
logger.Info("fetch service started")
|
logger.Info("fetch service started")
|
||||||
|
|
||||||
procs := process.NewProcessors(openAIClient)
|
procs := process.NewProcessors(openAIClient)
|
||||||
pipeline := process.NewPipeline(fetcher.Out(), procs, videoRelRepo, wvClient, logger)
|
for i := 0; i < 4; i++ {
|
||||||
go pipeline.Run()
|
go process.NewPipeline(fetcher.Out(), procs, videoRelRepo, wvClient, logger.With(slog.Int("pipeline", i))).Run()
|
||||||
|
}
|
||||||
logger.Info("processing service started")
|
logger.Info("processing service started")
|
||||||
|
|
||||||
port, err := strconv.Atoi(getParam("API_PORT", "8080"))
|
port, err := strconv.Atoi(getParam("API_PORT", "8080"))
|
||||||
|
|
Loading…
Reference in New Issue