remove extra async execution
This commit is contained in:
@@ -46,8 +46,7 @@ func (pages *MemoryChunkPages) FlushData() error {
|
|||||||
if !pages.hasWrites {
|
if !pages.hasWrites {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
pages.saveChunkedFileToStorage()
|
pages.uploadPipeline.FlushAll()
|
||||||
pages.writeWaitGroup.Wait()
|
|
||||||
if pages.lastErr != nil {
|
if pages.lastErr != nil {
|
||||||
return fmt.Errorf("flush data: %v", pages.lastErr)
|
return fmt.Errorf("flush data: %v", pages.lastErr)
|
||||||
}
|
}
|
||||||
@@ -65,18 +64,9 @@ func (pages *MemoryChunkPages) GetStorageOptions() (collection, replication stri
|
|||||||
return pages.collection, pages.replication
|
return pages.collection, pages.replication
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pages *MemoryChunkPages) saveChunkedFileToStorage() {
|
|
||||||
|
|
||||||
pages.uploadPipeline.FlushAll()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pages *MemoryChunkPages) saveChunkedFileIntevalToStorage(reader io.Reader, offset int64, size int64, cleanupFn func()) {
|
func (pages *MemoryChunkPages) saveChunkedFileIntevalToStorage(reader io.Reader, offset int64, size int64, cleanupFn func()) {
|
||||||
|
|
||||||
mtime := time.Now().UnixNano()
|
mtime := time.Now().UnixNano()
|
||||||
pages.writeWaitGroup.Add(1)
|
|
||||||
writer := func() {
|
|
||||||
defer pages.writeWaitGroup.Done()
|
|
||||||
defer cleanupFn()
|
defer cleanupFn()
|
||||||
|
|
||||||
chunk, collection, replication, err := pages.fh.f.wfs.saveDataAsChunk(pages.fh.f.fullpath())(reader, pages.fh.f.Name, offset)
|
chunk, collection, replication, err := pages.fh.f.wfs.saveDataAsChunk(pages.fh.f.fullpath())(reader, pages.fh.f.Name, offset)
|
||||||
@@ -95,14 +85,6 @@ func (pages *MemoryChunkPages) saveChunkedFileIntevalToStorage(reader io.Reader,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if pages.fh.f.wfs.concurrentWriters != nil {
|
|
||||||
pages.fh.f.wfs.concurrentWriters.Execute(writer)
|
|
||||||
} else {
|
|
||||||
go writer()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pages MemoryChunkPages) Destroy() {
|
func (pages MemoryChunkPages) Destroy() {
|
||||||
pages.uploadPipeline.Shutdown()
|
pages.uploadPipeline.Shutdown()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user