|
|
|
@ -22,6 +22,11 @@ func Productor(channel chan string, dbw *database.DbWorker) {
|
|
|
|
|
|
|
|
|
|
// 消费者负责执行shell
|
|
|
|
|
func Consumer(channel chan string, dbw *database.DbWorker, wg *sync.WaitGroup, osslink string) {
|
|
|
|
|
|
|
|
|
|
//errOut :=*utils.Log
|
|
|
|
|
//logfile,_:=os.OpenFile("logs/objectss_err.log", os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)
|
|
|
|
|
//errOut.SetOutput(logfile)
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
path, ok := <-channel // 此处会阻塞, 如果信道中没有数据的话
|
|
|
|
|
if ok {
|
|
|
|
@ -35,12 +40,12 @@ func Consumer(channel chan string, dbw *database.DbWorker, wg *sync.WaitGroup, o
|
|
|
|
|
|
|
|
|
|
fmt.Println("shell:", copyExec)
|
|
|
|
|
s, err := Exec_linux_shell(copyExec)
|
|
|
|
|
utils.Log.Info("copy exec_shell: ", s, " err", err)
|
|
|
|
|
// 拷贝完成后,更新数据 oss=1
|
|
|
|
|
if err == nil {
|
|
|
|
|
dbw.UpdateRepositoryOssbyPath(path)
|
|
|
|
|
} else {
|
|
|
|
|
utils.Log.Errorf("objectStore upload Failed:commad %s :Git Path %s:shell exec return %", copyExec, path, s, " err", err)
|
|
|
|
|
utils.Log.Errorf("对象存储命令行执行失败,错误为: %s ; 执行命令为: %s ; 命令返回值: %s ",err,copyExec,s )
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|