-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Calling model::create() does an _exists() twice if the record doesn't exist #14256
Comments
Looking at the code it kind of makes sense because Not sure how to refactor this to keep on offering the same functionality. We can certainly remove Thoughts? |
There is definitely a bug here -
Replica lag means that you will never be 100% correct when checking if a record exists if you check the read connection. |
@david-duncan good catch |
Maybe we could set operationMade to OP_CREATE in the create method before calling save and skip the check if it's already defined? |
Resolved |
Wait it still does two selects... since we do a check on the write connection, the check on the read one is not useful... this will slow down the app if there are a lot of inserts |
* 4.0.x: (202 commits) Updated changelog Changing the interface to return null for getEventsManager Correcting interface Correcting tests Fixed Firewall\Adapter\AbstractAdapter::setEventsManager Remove void return type for constructors Fixed return types for various methods to satisfy interface declaration Constructors should never declare return type [skip appveyor] Updated changelog Styling fix changelog Fixed remove() not removing service #14396 Forgot to push changelog Use write connection on create to prevent replica lag. Fix #14256 Added license information in README Moved license files to 3rdparty/license. Added more licenses Update issue templates Backup old template file Update issue templates [4.0.x] - Corrected test [4.0.x] - Fixing stupid error ...
Expected and Actual Behavior
Calling model::create() does an _exists() twice if the record doesn't exist.
cphalcon/phalcon/Mvc/Model.zep
Line 964 in 2be495d
cphalcon/phalcon/Mvc/Model.zep
Line 2316 in 2be495d
Details
php --ri phalcon
) all the way to 4.0.x from 3.0.xphp -v
) any😞 😞
The text was updated successfully, but these errors were encountered: