Skip to content

Commit

Permalink
removed locks and fixed synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsgrill committed Oct 26, 2024
1 parent f487289 commit a2c69f2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 1 addition & 4 deletions core/cfapi/filesystem/synclocaltoremote.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ func (instance *VirtualizationInstance) isDeletedRemotely(remotepath string, loc
}

func (instance *VirtualizationInstance) syncLocalToRemote() error {
instance.lock.Lock()
defer instance.lock.Unlock()
return filepath.Walk(instance.rootPath, func(localpath string, localinfo fs.FileInfo, err error) error {
instance.Logger.Debug().Msgf("Syncing local file '%s'", localpath)
if os.IsNotExist(err) {
Expand Down Expand Up @@ -84,7 +82,7 @@ func (instance *VirtualizationInstance) syncLocalToRemote() error {
remoteinfo, err := instance.fs.Stat(path)
var localisnewer bool
if os.IsNotExist(err) {
localisnewer = false
localisnewer = true
} else if err != nil {
return fmt.Errorf("syncLocalToRemote.1 %w", err)
} else if remoteinfo == nil {
Expand All @@ -107,7 +105,6 @@ func (instance *VirtualizationInstance) syncLocalToRemote() error {
}
// mark file as in-sync
return instance.setInSync(localpath)

}

if deleted {
Expand Down
2 changes: 0 additions & 2 deletions core/cfapi/filesystem/syncremotetolocal.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
)

func (instance *VirtualizationInstance) syncRemoteToLocal() error {
instance.lock.Lock()
defer instance.lock.Unlock()
return utils.Walk(instance.fs, "", func(path string, remoteinfo fs.FileInfo, err error) error {
instance.Logger.Debug().Msgf("Syncing remote file '%s'", path)
if os.IsNotExist(err) {
Expand Down

0 comments on commit a2c69f2

Please sign in to comment.