-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't wait while pushing #310
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: Sander Pick <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -642,7 +642,10 @@ func (n *net) AddRecord(ctx context.Context, id thread.ID, lid peer.ID, rec core | |
if err = rec.Verify(logpk); err != nil { | ||
return err | ||
} | ||
return n.PutRecord(ctx, id, lid, rec) | ||
if err = n.PutRecord(ctx, id, lid, rec); err != nil { | ||
return err | ||
} | ||
return n.server.pushRecord(ctx, id, lid, rec) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surely this must have been a bug... why not push out records from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. Eventually, this can be different if we plan to batch pushes or similar, but not the case now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice yeah, good call |
||
} | ||
|
||
func (n *net) GetRecord(ctx context.Context, id thread.ID, rid cid.Cid, opts ...core.ThreadOption) (core.Record, error) { | ||
|
@@ -819,10 +822,10 @@ func (n *net) putRecord(ctx context.Context, id thread.ID, lid peer.ID, rec core | |
|
||
log.Debugf("put record %s (thread=%s, log=%s)", r.Cid(), id, lg.ID) | ||
|
||
if err = n.bus.SendWithTimeout(NewRecord(r, id, lg.ID), notifyTimeout); err != nil { | ||
if err = n.store.SetHead(id, lg.ID, r.Cid()); err != nil { | ||
return err | ||
} | ||
if err = n.store.SetHead(id, lg.ID, r.Cid()); err != nil { | ||
if err = n.bus.SendWithTimeout(NewRecord(r, id, lg.ID), notifyTimeout); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just flipping the order here. Seems safer to set the head before broadcasting. |
||
return err | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember why we waited here... probably out of an abundance of caution while developing.