Adding initial retry layer version (#14954)
* Adding initial retry layer version * Some simplification around the generated code * Generating retry layer again * Improving naming generation in store generated layers * Address PR review comments * Updating store layers * Addressing PR review comments * fixing lint errors * Updating store layers * Adding license header * Applying the retry layer to the reaction_store * Regenerating retry layer
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c89c56ab2e
Коммит
1b141678fe
@@ -736,28 +736,25 @@ func (s SqlChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64)
|
||||
}
|
||||
|
||||
var newChannel *model.Channel
|
||||
err := store.WithDeadlockRetry(func() error {
|
||||
transaction, err := s.GetMaster().Begin()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "begin_transaction")
|
||||
}
|
||||
defer finalizeTransaction(transaction)
|
||||
transaction, err := s.GetMaster().Begin()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "begin_transaction")
|
||||
}
|
||||
defer finalizeTransaction(transaction)
|
||||
|
||||
newChannel, err = s.saveChannelT(transaction, channel, maxChannelsPerTeam)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newChannel, err = s.saveChannelT(transaction, channel, maxChannelsPerTeam)
|
||||
if err != nil {
|
||||
return newChannel, err
|
||||
}
|
||||
|
||||
// Additionally propagate the write to the PublicChannels table.
|
||||
if err := s.upsertPublicChannelT(transaction, newChannel); err != nil {
|
||||
return errors.Wrap(err, "upsert_public_channel")
|
||||
}
|
||||
// Additionally propagate the write to the PublicChannels table.
|
||||
if err = s.upsertPublicChannelT(transaction, newChannel); err != nil {
|
||||
return nil, errors.Wrap(err, "upsert_public_channel")
|
||||
}
|
||||
|
||||
if err := transaction.Commit(); err != nil {
|
||||
return errors.Wrap(err, "commit_transaction")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err = transaction.Commit(); err != nil {
|
||||
return nil, errors.Wrap(err, "commit_transaction")
|
||||
}
|
||||
// There are cases when in case of conflict, the original channel value is returned.
|
||||
// So we return both and let the caller do the checks.
|
||||
return newChannel, err
|
||||
|
||||
Ссылка в новой задаче
Block a user