Skip to content

Commit

Permalink
Log empty folders
Browse files Browse the repository at this point in the history
  • Loading branch information
dimm0 committed May 8, 2019
1 parent 2a0d474 commit 255886b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ build:
GOOS=linux GOARCH=amd64 go build

upload:
scp pdm dmishin@oasis-bobcat:/home/dmishin/
scp pdm dmishin@oasis-bobcat:/home/dmishin/pdm/
8 changes: 8 additions & 0 deletions workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ func processFolder(fromDataStore storage_backend, toDataStore storage_backend, t
return err
}

count := 0

for dir := range dirsChan {
count++
msgTask := task{
"copy",
dir}
Expand All @@ -526,6 +529,7 @@ func processFolder(fromDataStore storage_backend, toDataStore storage_backend, t
}

for files := range filesChan {
count++
msgTask := task{
"copy",
files}
Expand All @@ -540,6 +544,10 @@ func processFolder(fromDataStore storage_backend, toDataStore storage_backend, t
pubChan <- msg
}

if count == 0 {
logger.Errorf("Folder %s is empty", dirPath)
}

case "clear":
if dirPath != "/" {
_, err := fromDataStore.GetMetadata(dirPath)
Expand Down

0 comments on commit 255886b

Please sign in to comment.