Commit 3d7bbff5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent edfe3e4c
...@@ -472,25 +472,25 @@ func (fs *FileStorage) _watcher(w *fsnotify.Watcher) (err error) { ...@@ -472,25 +472,25 @@ func (fs *FileStorage) _watcher(w *fsnotify.Watcher) (err error) {
mainloop: mainloop:
for { for {
if !first { if !first {
tracef("select ...") //tracef("select ...")
select { select {
// XXX handle close // XXX handle close
case err := <-w.Errors: case err := <-w.Errors:
tracef("error: %s", err) //tracef("error: %s", err)
if err != fsnotify.ErrEventOverflow { if err != fsnotify.ErrEventOverflow {
return err return err
} }
// events lost, but it is safe since we are always rechecking file size // events lost, but it is safe since we are always rechecking file size
case e := <-w.Events: case <-w.Events:
// we got some kind of "file was modified" event (e.g. // we got some kind of "file was modified" event (e.g.
// write, truncate, chown ...) -> it is time to check the file again. // write, truncate, chown ...) -> it is time to check the file again.
tracef("event: %s", e) //tracef("event: %s", e)
case <-tick.C: case <-tick.C:
// recheck the file periodically. // recheck the file periodically.
tracef("tick") //tracef("tick")
} }
} }
first = false first = false
...@@ -512,7 +512,7 @@ mainloop: ...@@ -512,7 +512,7 @@ mainloop:
// there is some data after toppos - try to advance as much as we can. // there is some data after toppos - try to advance as much as we can.
// start iterating afresh with empty buffer. // start iterating afresh with empty buffer.
tracef("scanning ...") //tracef("scanning ...")
it := Iterate(seqReadAt(f), idx.TopPos, IterForward) it := Iterate(seqReadAt(f), idx.TopPos, IterForward)
for { for {
err = it.NextTxn(LoadNoStrings) err = it.NextTxn(LoadNoStrings)
......
...@@ -348,6 +348,7 @@ func BenchmarkIterate(b *testing.B) { ...@@ -348,6 +348,7 @@ func BenchmarkIterate(b *testing.B) {
b.StopTimer() b.StopTimer()
} }
// XXX kill
var tracef = func(format string, argv ...interface{}) { var tracef = func(format string, argv ...interface{}) {
log.Printf("W " + format, argv...) log.Printf("W " + format, argv...)
} }
...@@ -405,7 +406,7 @@ func TestWatch(t *testing.T) { ...@@ -405,7 +406,7 @@ func TestWatch(t *testing.T) {
} }
xcommit := func(at zodb.Tid, objv ...Object) zodb.Tid { xcommit := func(at zodb.Tid, objv ...Object) zodb.Tid {
tracef("\n\n-> xcommit %s", at) tracef("-> xcommit %s", at)
defer tracef("<- xcommit") defer tracef("<- xcommit")
t.Helper() t.Helper()
tid, err := zcommit(at, objv...) tid, err := zcommit(at, objv...)
...@@ -444,7 +445,7 @@ func TestWatch(t *testing.T) { ...@@ -444,7 +445,7 @@ func TestWatch(t *testing.T) {
// run py `zodb commit`. // run py `zodb commit`.
// //
// if one day it is either fixed, or worked around, we could ↑ 10 to 100. // if one day it is either fixed, or worked around, we could ↑ 10 to 100.
for i := zodb.Oid(0); i < 10; i++ { for i := zodb.Oid(1); i <= 10; i++ {
at = xcommit(at, at = xcommit(at,
Object{0, fmt.Sprintf("data0.%d", i)}, Object{0, fmt.Sprintf("data0.%d", i)},
Object{i, fmt.Sprintf("data%d", i)}) Object{i, fmt.Sprintf("data%d", i)})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment