Skip to content

Commit

Permalink
nsq_to_file: s/atomicRename/exclusiveRename
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Jan 3, 2019
1 parent c594894 commit 3616a7d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/nsq_to_file/file_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (f *FileLogger) Close() {

// Optimistic rename
log.Printf("INFO: moving finished file %s to %s", src, dst)
err := atomicRename(src, dst)
err := exclusiveRename(src, dst)
if err == nil {
return
} else if !os.IsExist(err) {
Expand All @@ -189,7 +189,7 @@ func (f *FileLogger) Close() {
for i := f.rev + 1; ; i++ {
log.Printf("INFO: destination file already exists: %s", dst)
dst := strings.Replace(dstTmpl, "<REV>", fmt.Sprintf("-%06d", i), -1)
err := atomicRename(src, dst)
err := exclusiveRename(src, dst)
if err != nil {
if os.IsExist(err) {
continue // next rev
Expand Down Expand Up @@ -346,7 +346,7 @@ func makeOutputDir(path string) {
}
}

func atomicRename(src, dst string) error {
func exclusiveRename(src, dst string) error {
err := os.Link(src, dst)
if err != nil {
return err
Expand Down

0 comments on commit 3616a7d

Please sign in to comment.