diff --git a/euscanwww/djeuscan/models.py b/euscanwww/djeuscan/models.py index e0418d4..e5abd81 100644 --- a/euscanwww/djeuscan/models.py +++ b/euscanwww/djeuscan/models.py @@ -272,9 +272,6 @@ class RefreshPackageQuery(models.Model): query = models.CharField(max_length=256, unique=True) priority = models.IntegerField(default=0) - class Meta: - get_latest_by = "priority" - def __unicode__(self): return u'[%d] %s' % (self.priority, self.query) diff --git a/euscanwww/djeuscan/processing/scan_metadata.py b/euscanwww/djeuscan/processing/scan_metadata.py index 4f06d05..02a8e84 100644 --- a/euscanwww/djeuscan/processing/scan_metadata.py +++ b/euscanwww/djeuscan/processing/scan_metadata.py @@ -96,8 +96,8 @@ class ScanMetadata(object): self.style.ERROR("Bad maintainer: '%s' '%s'" % \ (maintainer.name, maintainer.email)) ) - obj.save() + return True def store_herd(self, name, email): if not name: @@ -142,6 +142,7 @@ def scan_metadata(packages=None, logger=None): for pkg in packages: if isinstance(pkg, Package): - scan_handler.scan('%s/%s' % (pkg.category, pkg.name), pkg) + result = scan_handler.scan('%s/%s' % (pkg.category, pkg.name), pkg) else: - scan_handler.scan(pkg) + result = scan_handler.scan(pkg) + return result diff --git a/euscanwww/djeuscan/processing/scan_portage.py b/euscanwww/djeuscan/processing/scan_portage.py index 34456ea..14d7a8e 100644 --- a/euscanwww/djeuscan/processing/scan_portage.py +++ b/euscanwww/djeuscan/processing/scan_portage.py @@ -299,5 +299,5 @@ def scan_portage(packages=None, no_log=False, purge_packages=False, if purge_versions: purge_versions(logger=logger, no_log=no_log) - logger.info('Done.') + return True diff --git a/euscanwww/djeuscan/processing/scan_upstream.py b/euscanwww/djeuscan/processing/scan_upstream.py index 045a32c..827ad91 100644 --- a/euscanwww/djeuscan/processing/scan_upstream.py +++ b/euscanwww/djeuscan/processing/scan_upstream.py @@ -131,11 +131,12 @@ def scan_upstream(packages=None, purge_versions=False, for pkg in packages: if isinstance(pkg, Package): - scan_handler.scan('%s/%s' % (pkg.category, pkg.name)) + result = scan_handler.scan('%s/%s' % (pkg.category, pkg.name)) else: - scan_handler.scan(pkg) + result = scan_handler.scan(pkg) if purge_versions: purge_versions(logger=logger) logger.info('Done.') + return result diff --git a/euscanwww/djeuscan/tasks.py b/euscanwww/djeuscan/tasks.py index 1e66838..4f6842e 100644 --- a/euscanwww/djeuscan/tasks.py +++ b/euscanwww/djeuscan/tasks.py @@ -114,7 +114,7 @@ def scan_metadata_all_task(): @task -def _scan_portage_task(packages, no_logs=False, purge_packages=False, +def _scan_portage_task(packages, no_log=False, purge_packages=False, purge_versions=False, prefetch=False): """ Scans portage for the given set of packages @@ -125,7 +125,7 @@ def _scan_portage_task(packages, no_logs=False, purge_packages=False, result = scan_portage( packages=packages, - no_logs=no_logs, + no_log=no_log, purge_packages=purge_packages, purge_versions=purge_versions, prefetch=prefetch, @@ -137,24 +137,24 @@ def _scan_portage_task(packages, no_logs=False, purge_packages=False, @task -def scan_portage_list_task(query, no_logs=False, purge_packages=False, +def scan_portage_list_task(query, no_log=False, purge_packages=False, purge_versions=False, prefetch=False): """ Runs a parallel portage scan for packages in the query list (space separated string). Task used only from the web interface. """ - kwargs = {"no_logs": no_logs, "purge_packages": purge_packages, + kwargs = {"no_log": no_log, "purge_packages": purge_packages, "purge_versions": purge_versions, "prefetch": prefetch} _run_in_chunks(_scan_portage_task, [p for p in query.split()], kwargs) @task -def scan_portage_all_task(no_logs=False, purge_packages=False, +def scan_portage_all_task(no_log=False, purge_packages=False, purge_versions=False, prefetch=False): """ Runs a parallel portage scan for all packages """ - kwargs = {"no_logs": no_logs, "purge_packages": purge_packages, + kwargs = {"no_log": no_log, "purge_packages": purge_packages, "purge_versions": purge_versions, "prefetch": prefetch} _run_in_chunks(_scan_metadata_task, Package.objects.all(), kwargs) @@ -251,8 +251,8 @@ def consume_refresh_package_request(): Satisfies user requests for package refreshing, runs every minute """ try: - obj = RefreshPackageQuery.objects.latest() - except RefreshPackageQuery.DoesNotExist: + obj = RefreshPackageQuery.objects.all().order_by('-priority')[0] + except IndexError: return {} else: result = scan_package_task(obj.query) @@ -277,7 +277,7 @@ admin_tasks = [ scan_portage_list_task, scan_upstream_all_task, scan_upstream_list_task, - update_portage_trees, + update_portage_trees_task, update_task, scan_package_task, ] diff --git a/euscanwww/djeuscan/templates/admin/djcelery/taskstate/change_list.html b/euscanwww/djeuscan/templates/admin/djcelery/taskstate/change_list.html index 0076a6c..db2680b 100644 --- a/euscanwww/djeuscan/templates/admin/djcelery/taskstate/change_list.html +++ b/euscanwww/djeuscan/templates/admin/djcelery/taskstate/change_list.html @@ -73,7 +73,7 @@ }); }); - setTimeout(location.reload, 10000); + setTimeout(location.reload, 30000); }); })(django.jQuery);