MCPcopy
hub / github.com/IceWhaleTech/CasaOS / CheckFileStatus

Function CheckFileStatus

service/file.go:147–179  ·  view source on GitHub ↗

file move or copy and send notify

()

Source from the content-addressed store, hash-verified

145
146// file move or copy and send notify
147func CheckFileStatus() {
148 for {
149 if len(OpStrArr) == 0 {
150 return
151 }
152 for _, v := range OpStrArr {
153 var total int64 = 0
154 item, ok := FileQueue.Load(v)
155 if !ok {
156 continue
157 }
158 temp := item.(model.FileOperate)
159 for i := 0; i < len(temp.Item); i++ {
160 if !temp.Item[i].Finished {
161 size, err := file.GetFileOrDirSize(temp.To + "/" + filepath.Base(temp.Item[i].From))
162 if err != nil {
163 continue
164 }
165 temp.Item[i].ProcessedSize = size
166 if size == temp.Item[i].Size {
167 temp.Item[i].Finished = true
168 }
169 total += size
170 } else {
171 total += temp.Item[i].ProcessedSize
172 }
173 }
174 temp.ProcessedSize = total
175 FileQueue.Store(v, temp)
176 }
177 time.Sleep(time.Second * 3)
178 }
179}
180func IsMounted(path string) bool {
181 mounted, _ := mountinfo.Mounted(path)
182 if mounted {

Callers 1

PostOperateFileOrDirFunction · 0.92

Calls 3

GetFileOrDirSizeFunction · 0.92
LoadMethod · 0.80
StoreMethod · 0.80

Tested by

no test coverage detected