bstrdsmkr/1Channel — pull request #167 by jasonshsoftware (2014-10-06 18:00:21+00:00)
Title: Update db_utils.py

Add db_version check and return early if same.

I noticed that trying to recreate the database if it already exists sometimes takes a long time. Often, it will fail out on creating the unique index. The next time I start the plugin, it will create a duplicate entry for the version in the db_info table, thus failing to create the unique index on the second attempt. I have to manually delete the index and the duplicate record.

If the version is already correct, we don't really need to try to recreate the db (unless there is some hidden weirdness that I don't know about). Instead, just short-circuit the init_database call. Doing this locally makes the plugin load really fast.

I am using MySQL and have not tested on local db. Of course since you are getting the db version already, i'm not worried about it not working on local db.