Skip to content

Commit

Permalink
Check if legacy offline queue file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
gandarez authored and alanhamlett committed Jul 29, 2024
1 parent 65ec92a commit 317e7bf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/offlinesync/offlinesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func syncOfflineActivityLegacy(v *viper.Viper, queueFilepath string) error {
return nil
}

if !fileExists(queueFilepath) {
return nil
}

paramOffline := params.LoadOfflineParams(v)

paramAPI, err := params.LoadAPIParams(v)
Expand Down Expand Up @@ -158,3 +162,9 @@ func SyncOfflineActivity(v *viper.Viper, queueFilepath string) error {

return nil
}

// fileExists checks if a file or directory exist.
func fileExists(fp string) bool {
_, err := os.Stat(fp)
return err == nil || os.IsExist(err)
}

0 comments on commit 317e7bf

Please sign in to comment.