package Engine import ( conf "leit.com/leit_seat_aps/config" "leit.com/leit_seat_aps/db" "leit.com/leit_seat_aps/glog" ) // 启动保存服务 // 同时通过协程从该管道中收取已完成的打印任务更新到数据库中 func StartSaver(conf *conf.EnvConfig,c chan db.PrintTask) { go func() { for { // 从管道获取要保存的任务 task := <-c // 关闭打印任务 m := new(db.PrintTask) err := m.ChangePrintTaskStatus(task, "C") if err != nil { glog.InfoExtln("Printer","Failed to close the print task :", task) } } }() }