Commit 8a5e3d10 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 18cf8955
......@@ -1411,18 +1411,16 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
defer head.zheadMu.RUnlock()
headAt := head.zconn.At()
if at < bfdir.δFtail.Tail() {
if at != zodb.InvalidTid && at < bfdir.δFtail.Tail() {
return fmt.Errorf("too far away back from head/at (@%s); δt = %s",
headAt, headAt.Time().Sub(at.Time().Time))
}
// XXX if watch was already established - we need to update it
// XXX locking (.byfile)
w := wlink.byfile[foid]
// if watch was already established - we need to update it
w := wlink.byfile[foid] // XXX locking
if w == nil {
// watch was not previously established - set it up anew
// XXX locking (.fileTab)
f := bfdir.fileTab[foid]
f := bfdir.fileTab[foid] // XXX locking
if f == nil {
// by "invalidation protocol" watch is setup after data file was opened
return fmt.Errorf("file not yet known to wcfs or is not a ZBigFile")
......@@ -1437,10 +1435,9 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
}
// at="-" (InvalidTid) means "remove the watch"
// XXX locking
if at == zodb.InvalidTid {
delete(wlink.byfile, foid)
delete(w.file.watchTab, w)
delete(wlink.byfile, foid) // XXX locking
delete(w.file.watchTab, w) // XXX locking
return nil
}
......
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