Remove redundant read event when --sync is used
This commit is contained in:
parent
c304fc4333
commit
87874bba88
@ -188,6 +188,7 @@ func Run(opts *Options, revision string) {
|
|||||||
if opts.Sync {
|
if opts.Sync {
|
||||||
eventBox.Unwatch(EvtReadNew)
|
eventBox.Unwatch(EvtReadNew)
|
||||||
eventBox.WaitFor(EvtReadFin)
|
eventBox.WaitFor(EvtReadFin)
|
||||||
|
eventBox.Unset(EvtReadNew)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go interactive
|
// Go interactive
|
||||||
@ -216,6 +217,9 @@ func Run(opts *Options, revision string) {
|
|||||||
reading = reading && evt == EvtReadNew
|
reading = reading && evt == EvtReadNew
|
||||||
snapshot, count := chunkList.Snapshot()
|
snapshot, count := chunkList.Snapshot()
|
||||||
terminal.UpdateCount(count, !reading, value.(bool))
|
terminal.UpdateCount(count, !reading, value.(bool))
|
||||||
|
if opts.Sync {
|
||||||
|
terminal.UpdateList(PassMerger(&snapshot, opts.Tac))
|
||||||
|
}
|
||||||
matcher.Reset(snapshot, terminal.Input(), false, !reading, sort)
|
matcher.Reset(snapshot, terminal.Input(), false, !reading, sort)
|
||||||
|
|
||||||
case EvtSearchNew:
|
case EvtSearchNew:
|
||||||
|
@ -45,6 +45,13 @@ func (b *EventBox) Set(event EventType, value interface{}) {
|
|||||||
b.cond.L.Unlock()
|
b.cond.L.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unset turns off the event type on the box
|
||||||
|
func (b *EventBox) Unset(event EventType) {
|
||||||
|
b.cond.L.Lock()
|
||||||
|
delete(b.events, event)
|
||||||
|
b.cond.L.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// Clear clears the events
|
// Clear clears the events
|
||||||
// Unsynchronized; should be called within Wait routine
|
// Unsynchronized; should be called within Wait routine
|
||||||
func (events *Events) Clear() {
|
func (events *Events) Clear() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user