-
Notifications
You must be signed in to change notification settings - Fork 27
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
db
component usage hardcode
#43
Comments
Hi @ilyachase ,
I assume, assumption for generality is a good thing because people like to have their extension turnkey but also easy to customize.
About 3 you are right. We better make it settable.
|
@udokmeci My point is that your extension is hard coupled to Mysql and the 'db' component, which isn't covered in the docs at all.
If you agree, I can help with PR. |
@ilyachase Regards, |
Hi there.
In file
BeanstalkController.php
from line305
to316
there is a lot of logic with a lot of assumptions.getDb()
you are trying to get it without any checks. It results inException 'yii\base\InvalidConfigException' with message 'Unknown component ID: db'
. In my app I don't havedb
component, but havemongodb
.db
in beanstalk workers? Moreover, I think it's developer's responsibility to make sure that db connection is up and available. If you want to put this logic in your extension, at least give it option to disable. For example, in Laravel this check happens by catching exceptions after any db query and checking if it's caused byhas gone away
error. If it is, it's just reconnect and executes query again.60 * 60
seconds will help? This value should correlate withwait_timeout
of the db.BeanstalkController.php:140
is a very big assumtion. I don't think you should every do that. You don't know what database the app uses and don't know what it supports. And there is one more31536000
value without any ability to change or disable it.The text was updated successfully, but these errors were encountered: