Commit c5d4e890 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bb378738
...@@ -192,12 +192,25 @@ func (b *ZBucket) PDeactivate() { ...@@ -192,12 +192,25 @@ func (b *ZBucket) PDeactivate() {
// PActivate implements Object. // PActivate implements Object.
func (b *ZBucket) PActivate(ctx context.Context) (bool, error) { func (b *ZBucket) PActivate(ctx context.Context) (bool, error) {
// XXX check if already activated
activated, err := b.pyObject.PActivate(ctx) activated, err := b.pyObject.PActivate(ctx)
if err != nil { if err != nil {
return err return err
} }
if !activated {
return false, nil
}
// FIXME other users must wait for first decode to complet
err = b.decode()
if err != nil {
b.pyObject.PDeactivate()
return false, err
}
return true, nil
}
func (b *ZBucket) decode() error {
t, ok := b.pyObject.pystate.(pickle.Tuple) t, ok := b.pyObject.pystate.(pickle.Tuple)
if !ok || !(1 <= len(t) && len(t) <= 2) { if !ok || !(1 <= len(t) && len(t) <= 2) {
// XXX complain // XXX complain
......
...@@ -533,7 +533,7 @@ func (pyobj *pyObject) PActivate(ctx context.Context) (bool, error) { ...@@ -533,7 +533,7 @@ func (pyobj *pyObject) PActivate(ctx context.Context) (bool, error) {
pyobj.pystate = pystate pyobj.pystate = pystate
pyobj.loaderr = err pyobj.loaderr = err
close(pyobj.ready) close(pyobj.ready)
return err // XXX err ctx return true, err // XXX err ctx
} }
......
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