mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-17 07:14:53 +00:00
Schedules reconnect is now working even if reconnect route is not available ( #3107)
This commit is contained in:
parent
8df45d150d
commit
2f515b725b
@ -16,11 +16,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from urllib.request import urlopen
|
||||
|
||||
from flask_babel import lazy_gettext as N_
|
||||
|
||||
from cps import config, logger
|
||||
from cps import config, logger, db, ub
|
||||
from cps.services.worker import CalibreTask
|
||||
|
||||
|
||||
@ -28,18 +26,12 @@ class TaskReconnectDatabase(CalibreTask):
|
||||
def __init__(self, task_message=N_('Reconnecting Calibre database')):
|
||||
super(TaskReconnectDatabase, self).__init__(task_message)
|
||||
self.log = logger.create()
|
||||
self.listen_address = config.get_config_ipaddress()
|
||||
self.listen_port = config.config_port
|
||||
self.calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||
|
||||
def run(self, worker_thread):
|
||||
address = self.listen_address if self.listen_address else 'localhost'
|
||||
port = self.listen_port if self.listen_port else 8083
|
||||
|
||||
try:
|
||||
urlopen('http://' + address + ':' + str(port) + '/reconnect')
|
||||
self._handleSuccess()
|
||||
except Exception as ex:
|
||||
self._handleError('Unable to reconnect Calibre database: ' + str(ex))
|
||||
self.calibre_db.reconnect_db(config, ub.app_DB_path)
|
||||
self.calibre_db.session.close()
|
||||
self._handleSuccess()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -70,7 +70,6 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
||||
self.log = logger.create()
|
||||
self.book_id = book_id
|
||||
self.app_db_session = ub.get_new_session_instance()
|
||||
# self.calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||
self.cache = fs.FileSystem()
|
||||
self.resolutions = [
|
||||
constants.COVER_THUMBNAIL_SMALL,
|
||||
|
@ -2,7 +2,6 @@ Werkzeug<3.0.0
|
||||
APScheduler>=3.6.3,<3.11.0
|
||||
Babel>=1.3,<3.0
|
||||
Flask-Babel>=0.11.1,<4.1.0
|
||||
# Flask-Login>=0.3.2,<0.6.4
|
||||
Flask-Principal>=0.3.2,<0.5.1
|
||||
Flask>=1.0.2,<3.1.0
|
||||
iso-639>=0.4.5,<0.5.0
|
||||
@ -21,4 +20,4 @@ Flask-Limiter>=2.3.0,<3.6.0
|
||||
regex>=2022.3.2,<2024.6.25
|
||||
bleach>=6.0.0,<6.2.0
|
||||
python-magic>=0.4.27,<0.5.0
|
||||
flask-httpAuth>=4.4.0
|
||||
flask-httpAuth>=4.4.0,<5.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user