don't add the fragment and then remove it

This commit is contained in:
Matt Jaffee 2018-12-11 15:39:42 -06:00
parent 8b3e5b998a
commit 9d4a6e2be7
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -212,12 +212,12 @@ func (v *view) CreateFragmentIfNotExists(shard uint64) (*fragment, error) {
if err == nil && msg != nil {
// Broadcast a message that a new max shard was just created.
if err = v.broadcaster.SendSync(msg); err != nil {
v.mu.Lock()
delete(v.fragments, shard)
v.mu.Unlock()
frag.close()
return nil, errors.Wrap(err, "sending createshard message")
}
v.mu.Lock()
v.fragments[shard] = frag
v.mu.Unlock()
}
return frag, err
@ -244,9 +244,6 @@ func (v *view) createFragmentIfNotExists(shard uint64) (*fragment, *CreateShardM
Shard: shard,
}
// Save to lookup.
v.fragments[shard] = frag
return frag, msg, nil
}