Skip to content

Commit

Permalink
Use write connection on create to prevent replica lag. Fix #14256
Browse files Browse the repository at this point in the history
  • Loading branch information
ruudboon authored and niden committed Sep 21, 2019
1 parent cd5aeb4 commit 870dff0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phalcon/Mvc/Model.zep
Original file line number Diff line number Diff line change
Expand Up @@ -955,10 +955,10 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
let metaData = this->getModelsMetaData();

/**
* Get the current connection
* Get the current connection use write to prevent replica lag
* If the record already exists we must throw an exception
*/
if this->_exists(metaData, this->getReadConnection()) {
if this->_exists(metaData, this->getWriteConnection()) {
let this->errorMessages = [
new Message(
"Record cannot be created because it already exists",
Expand Down

0 comments on commit 870dff0

Please sign in to comment.