use Set method to update ExportPath for csv/fwv ee

prevents manual locking
This commit is contained in:
ionutboangiu
2025-11-04 13:52:23 +02:00
committed by Dan Christian Bogos
parent 83bc694b92
commit 36633ec11a
2 changed files with 2 additions and 6 deletions

View File

@@ -66,9 +66,7 @@ func (fCsv *FileCSVee) init(wrtr io.WriteCloser) (err error) {
// create the file
filePath := path.Join(fCsv.Cfg().ExportPath,
fCsv.Cfg().ID+utils.Underline+utils.UUIDSha1Prefix()+utils.CSVSuffix)
fCsv.dc.Lock()
fCsv.dc.MapStorage[utils.ExportPath] = filePath
fCsv.dc.Unlock()
fCsv.dc.Set([]string{utils.ExportPath}, filePath)
if fCsv.cfg.ExportPath == utils.MetaBuffer {
fCsv.wrtr = wrtr
} else if fCsv.wrtr, err = os.Create(filePath); err != nil {

View File

@@ -60,9 +60,7 @@ type FileFWVee struct {
func (fFwv *FileFWVee) init(writer io.Writer) (err error) {
filePath := path.Join(fFwv.Cfg().ExportPath,
fFwv.Cfg().ID+utils.Underline+utils.UUIDSha1Prefix()+utils.FWVSuffix)
fFwv.dc.Lock()
fFwv.dc.MapStorage[utils.ExportPath] = filePath
fFwv.dc.Unlock()
fFwv.dc.Set([]string{utils.ExportPath}, filePath)
// create the file
if fFwv.cfg.ExportPath == utils.MetaBuffer {
fFwv.writer = &buffer{writer}