mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
do a .task_dec() when an exception happens
This commit is contained in:
parent
21a9eec31b
commit
906254e6b5
1 changed files with 7 additions and 1 deletions
|
@ -6,6 +6,7 @@ import logging
|
|||
import configparser
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from tornado.stack_context import ExceptionStackContext
|
||||
|
||||
from .lib import nicelogger
|
||||
from .get_version import get_version
|
||||
|
@ -87,7 +88,12 @@ class Source:
|
|||
if name == '__config__':
|
||||
continue
|
||||
self.task_inc()
|
||||
get_version(name, config[name], self.print_version_update)
|
||||
with ExceptionStackContext(self._handle_exception):
|
||||
get_version(name, config[name], self.print_version_update)
|
||||
|
||||
def _handle_exception(self, type, value, traceback):
|
||||
self.task_dec()
|
||||
raise value.with_traceback(traceback)
|
||||
|
||||
def task_inc(self):
|
||||
self.tasks += 1
|
||||
|
|
Loading…
Add table
Reference in a new issue