Skip to content
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

Fix version check scheduler running twice #9057

Merged
merged 5 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 0 additions & 95 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion medusa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self):
self.GIT_USERNAME = None
self.GIT_PASSWORD = None
self.GIT_TOKEN = None
self._GIT_PATH = None
self._GIT_PATH = ''
self.DEVELOPER = False

self.NEWS_URL = '{base_url}/news/news.md'.format(base_url=self.BASE_PYMEDUSA_URL)
Expand Down
17 changes: 13 additions & 4 deletions medusa/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def change_VERSION_NOTIFY(version_notify):

old_setting = app._VERSION_NOTIFY

app._VERSION_NOTIFY = version_notify
app._VERSION_NOTIFY = bool(version_notify)

if not version_notify:
app.NEWEST_VERSION_STRING = None
Expand All @@ -388,9 +388,18 @@ def change_GIT_PATH(path):
return

app._GIT_PATH = path
app.version_check_scheduler = None

if app.version_check_scheduler:
app.version_check_scheduler.stop.set()
app.version_check_scheduler.join(10)
app.version_check_scheduler = None

app.version_check_scheduler = scheduler.Scheduler(
CheckVersion(), cycleTime=datetime.timedelta(hours=app._UPDATE_FREQUENCY), threadName='CHECKVERSION', silent=False)
CheckVersion(),
cycleTime=datetime.timedelta(hours=app._UPDATE_FREQUENCY),
threadName='CHECKVERSION',
silent=False)

app.version_check_scheduler.enable = True
app.version_check_scheduler.start()
app.version_check_scheduler.forceRun()
Expand Down Expand Up @@ -824,7 +833,7 @@ def migrate_config(self):
else:
log.info(u'Proceeding with upgrade')

# do the migration, expect a method named _migrate_v<num>
# do the migration, expect a method named _migrate_v<num>
log.info(u'Migrating config up to version {version} {migration_name}',
{'version': next_version, 'migration_name': migration_name})
getattr(self, '_migrate_v' + str(next_version))()
Expand Down
4 changes: 2 additions & 2 deletions medusa/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def __init__(self, filename=None, suffix=None, row_type='dict'):
self._set_row_factory()

except sqlite3.OperationalError:
logger.log(u'Please check your database owner/permissions: {}'.format(
self.path, logger.WARNING))
logger.log(u'Please check your database owner/permissions: {0}'.format(
self.path), logger.WARNING)
except Exception as e:
logger.log(u'DB error: ' + ex(e), logger.ERROR)
raise
Expand Down
3 changes: 1 addition & 2 deletions medusa/server/web/config/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ def saveGeneral(self, log_dir=None, log_nr=5, log_size=1, web_port=None, notify_
app.GIT_RESET = config.checkbox_to_value(git_reset)
app.GIT_RESET_BRANCHES = [helpers.to_text(branch) for branch in
helpers.ensure_list(git_reset_branches)]
if app.GIT_PATH != git_path:
if git_path is not None and app.GIT_PATH != git_path:
app.GIT_PATH = git_path
config.change_GIT_PATH()
app.GIT_REMOTE = git_remote
app.CALENDAR_UNPROTECTED = config.checkbox_to_value(calendar_unprotected)
app.CALENDAR_ICONS = config.checkbox_to_value(calendar_icons)
Expand Down
1 change: 0 additions & 1 deletion medusa/session/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def __init__(self, proxies=None, **kwargs):

def _add_proxies(self):
"""As we're dependent on medusa app config. We need to set the proxy before the classes are initialized."""

def get_proxy_setting():
config = {
'ProviderSession': app.PROXY_PROVIDERS,
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ flake8-ignore =
D401
W503
W504
E741
medusa/__init__.py D104 F401
medusa/app.py N802
medusa/bs4_parser.py D100 D101 D102 D105
Expand Down
36 changes: 4 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def get_app_version():
long_description = r.read()


def install_requires():
with open(os.path.join(here, 'requirements.txt'), 'r') as r:
def test_install_requires():
with open(os.path.join(here, 'test_requirements.txt'), 'r') as r:
return r.read().splitlines(keepends=False)


Expand All @@ -66,10 +66,6 @@ def packages():
return result


# These requirements probably won't be needed
# when `install_requires` is populated with `requirements.txt`
tests_runtime_require = ['tornado==5.1.1', 'six>=1.13.0', 'profilehooks', 'contextlib2', ]

setup(
name='pymedusa',
description='Automatic Video Library Manager for TV Shows',
Expand All @@ -92,31 +88,7 @@ def packages():
]
},
cmdclass={'test': PyTest},
tests_require=tests_runtime_require + [
# zipp v2.0.0 dropped support for Python 2 (flake8 -> importlib-metadata -> zipp)
'zipp < 2.0.0 ; python_version == "2.*"',
# configparser v5.0.0 dropped support for Python 2
'configparser < 5.0.0 ; python_version == "2.*"',
# pyparsing 3.0.0 dropped support for Python 2
'pyparsing < 3.0.0 ; python_version == "2.*"',
'flake8==3.7.9',
'pycodestyle==2.5.0',
'flake8-docstrings>=1.3.0',
'flake8-import-order>=0.18',
'flake8-quotes>=1.0.0',
'pep8-naming>=0.7.0',
'pytest<5.0.0 ; python_version < "3.5"',
# pytest 6.2.x bugged at the moment.
'pytest==6.1.2 ; python_version >= "3.5"',
'pytest-cov>=2.6.1',
'pytest-flake8>=1.0.4',
'pytest-tornado>=0.8.1',
'PyYAML>=5.1',
'vcrpy<4.0.0 ; python_version < "3.5"',
'vcrpy>=4.0.0 ; python_version >= "3.5"',
'mock<=3.0.5 ; python_version <= "3.5"',
'mock>=3.0.5 ; python_version > "3.5"',
],
tests_require=test_install_requires(),
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: End Users/Desktop',
Expand All @@ -132,4 +104,4 @@ def packages():
'Topic :: Internet',
'Topic :: Multimedia :: Video',
],
)
)
2 changes: 2 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pytest-cov==2.11.0
pytest-flake8==1.0.7
pytest-tornado==0.8.1
PyYAML==5.3.1
six==1.15.0
tornado==5.1.1
vcrpy<4.0.0 ; python_version < "3.5"
vcrpy>=4.0.0 ; python_version >= "3.5"
mock<=3.0.5 ; python_version <= "3.5"
Expand Down