28 lines
516 B
Go
28 lines
516 B
Go
|
package task
|
||
|
|
||
|
import (
|
||
|
"pcgamedb/crawler"
|
||
|
|
||
|
"go.uber.org/zap"
|
||
|
)
|
||
|
|
||
|
func UpdateOutdatedGameInfos(logger *zap.Logger) {
|
||
|
channel, err := crawler.UpdateGameInfo(10)
|
||
|
count := 0
|
||
|
if err != nil {
|
||
|
logger.Error("Failed to update game info", zap.Error(err))
|
||
|
return
|
||
|
}
|
||
|
for info := range channel {
|
||
|
logger.Info("Updated game info",
|
||
|
zap.String("id", info.ID.String()),
|
||
|
zap.String("name", info.Name),
|
||
|
)
|
||
|
count++
|
||
|
if count == 10 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
logger.Info("Updated game info count", zap.Int("count", count))
|
||
|
}
|