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)
|
||||
if next == nil {
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,9 @@ func main() {
|
|||
logger.Info("fetch service started")
|
||||
|
||||
procs := process.NewProcessors(openAIClient)
|
||||
pipeline := process.NewPipeline(fetcher.Out(), procs, videoRelRepo, wvClient, logger)
|
||||
go pipeline.Run()
|
||||
for i := 0; i < 4; i++ {
|
||||
go process.NewPipeline(fetcher.Out(), procs, videoRelRepo, wvClient, logger.With(slog.Int("pipeline", i))).Run()
|
||||
}
|
||||
logger.Info("processing service started")
|
||||
|
||||
port, err := strconv.Atoi(getParam("API_PORT", "8080"))
|
||||
|
|
Loading…
Reference in New Issue