mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-18 06:00:32 +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
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# 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 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
|
from cps.services.worker import CalibreTask
|
||||||
|
|
||||||
|
|
||||||
@ -28,18 +26,12 @@ class TaskReconnectDatabase(CalibreTask):
|
|||||||
def __init__(self, task_message=N_('Reconnecting Calibre database')):
|
def __init__(self, task_message=N_('Reconnecting Calibre database')):
|
||||||
super(TaskReconnectDatabase, self).__init__(task_message)
|
super(TaskReconnectDatabase, self).__init__(task_message)
|
||||||
self.log = logger.create()
|
self.log = logger.create()
|
||||||
self.listen_address = config.get_config_ipaddress()
|
self.calibre_db = db.CalibreDB(expire_on_commit=False, init=True)
|
||||||
self.listen_port = config.config_port
|
|
||||||
|
|
||||||
def run(self, worker_thread):
|
def run(self, worker_thread):
|
||||||
address = self.listen_address if self.listen_address else 'localhost'
|
self.calibre_db.reconnect_db(config, ub.app_DB_path)
|
||||||
port = self.listen_port if self.listen_port else 8083
|
self.calibre_db.session.close()
|
||||||
|
self._handleSuccess()
|
||||||
try:
|
|
||||||
urlopen('http://' + address + ':' + str(port) + '/reconnect')
|
|
||||||
self._handleSuccess()
|
|
||||||
except Exception as ex:
|
|
||||||
self._handleError('Unable to reconnect Calibre database: ' + str(ex))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -70,7 +70,6 @@ class TaskGenerateCoverThumbnails(CalibreTask):
|
|||||||
self.log = logger.create()
|
self.log = logger.create()
|
||||||
self.book_id = book_id
|
self.book_id = book_id
|
||||||
self.app_db_session = ub.get_new_session_instance()
|
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.cache = fs.FileSystem()
|
||||||
self.resolutions = [
|
self.resolutions = [
|
||||||
constants.COVER_THUMBNAIL_SMALL,
|
constants.COVER_THUMBNAIL_SMALL,
|
||||||
|
@ -2,7 +2,6 @@ Werkzeug<3.0.0
|
|||||||
APScheduler>=3.6.3,<3.11.0
|
APScheduler>=3.6.3,<3.11.0
|
||||||
Babel>=1.3,<3.0
|
Babel>=1.3,<3.0
|
||||||
Flask-Babel>=0.11.1,<4.1.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-Principal>=0.3.2,<0.5.1
|
||||||
Flask>=1.0.2,<3.1.0
|
Flask>=1.0.2,<3.1.0
|
||||||
iso-639>=0.4.5,<0.5.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
|
regex>=2022.3.2,<2024.6.25
|
||||||
bleach>=6.0.0,<6.2.0
|
bleach>=6.0.0,<6.2.0
|
||||||
python-magic>=0.4.27,<0.5.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