From 4052448a0d16ea047fd465dfa6c79da71e10d1fa Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Fri, 20 Dec 2024 18:19:35 +0700 Subject: [PATCH] debug multi download --- core/sys/fs_mem.go | 4 +++- wasmsdk/blobber.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/sys/fs_mem.go b/core/sys/fs_mem.go index 6c088d881..83c708c4d 100644 --- a/core/sys/fs_mem.go +++ b/core/sys/fs_mem.go @@ -5,6 +5,7 @@ package sys import ( "errors" + "fmt" "io/fs" "os" "path/filepath" @@ -42,9 +43,10 @@ func (mfs *MemFS) Open(name string) (File, error) { defer mfs.Unlock() file := mfs.files[name] if file != nil { + fmt.Println("file exists", name) return file, nil } - + fmt.Println("does not exist", name) fileName := filepath.Base(name) file = &MemFile{Name: fileName, Mode: fs.ModePerm, ModTime: time.Now()} diff --git a/wasmsdk/blobber.go b/wasmsdk/blobber.go index 737b0bbc1..99c5b8ed3 100644 --- a/wasmsdk/blobber.go +++ b/wasmsdk/blobber.go @@ -466,7 +466,7 @@ func multiDownload(allocationID, jsonMultiDownloadOptions, authTicket, callbackF wg.Add(len(options)) for ind, option := range options { fileName := strings.Replace(path.Base(option.RemotePath), "/", "-", -1) - localPath := allocationID + "_" + fileName + localPath := encryption.FastHash(allocationID + "_" + fileName + zboxutil.NewConnectionId()) option.LocalPath = localPath statusBar := &StatusBar{wg: wg, totalBytesMap: make(map[string]int)} allStatusBar[ind] = statusBar @@ -487,6 +487,7 @@ func multiDownload(allocationID, jsonMultiDownloadOptions, authTicket, callbackF return "", err } } else { + fmt.Println("Downloading to memory: ", localPath, option.RemotePath) statusBar.localPath = localPath fs, _ := sys.Files.Open(localPath) mf, _ = fs.(*sys.MemFile)