Skip to content

tail will stop when deal with rotate log #189

Description

@lwtju

it will stop when tail the log which is deleted periodically and a new one created.
I think it cased by the code follow:

func (fc *FileChanges) NotifyDeleted() {
sendOnlyIfEmpty(fc.Deleted)
}

// sendOnlyIfEmpty sends on a bool channel only if the channel has no
// backlog to be read by other goroutines. This concurrency pattern
// can be used to notify other goroutines if and only if they are
// looking for it (i.e., subsequent notifications can be compressed
// into one).
func sendOnlyIfEmpty(ch chan bool) {
select {
case ch <- true:
default:
}
}

sendOnlyIfEmpty will not send true until the recevier of fc.Deleted is ready. And the receiver comes to be ready only when io.EOF appears. That means when EOF comes, the event of deleted has passed away. waitForChanges() can not do anything but wait.

image

so, notifyDeleted should wait (drop sendOnlyIfEmpty). it is different with modified event.
By the way, the name of sendOnlyIfEmpty makes confused.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions