mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 09:54:14 +02:00
Merge branch 'staging' into modules
# Conflicts: # fpakman/core/controller.py
This commit is contained in:
@@ -11,8 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- env variables / arguments FPAKMAN_SNAP / FPAKMAN_FLATPAK were removed. To disable a supported type, just uninstall its module.
|
- env variables / arguments FPAKMAN_SNAP / FPAKMAN_FLATPAK were removed. To disable a supported type, just uninstall its module.
|
||||||
|
|
||||||
## [0.5.1]
|
## [0.5.1]
|
||||||
|
### Improvements:
|
||||||
|
- suggestions are now retrieved asynchronously. Response time takes 45% less.
|
||||||
### Fixes:
|
### Fixes:
|
||||||
- flatpak dependency
|
- [flatpak dependency](https://github.com/vinifmor/fpakman/issues/36)
|
||||||
|
|
||||||
## [0.5.0] - 2019-08-06
|
## [0.5.0] - 2019-08-06
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
from threading import Thread
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
|
|
||||||
from fpakman_api.abstract.controller import ApplicationManager
|
from fpakman_api.abstract.controller import ApplicationManager
|
||||||
@@ -210,13 +211,21 @@ class GenericApplicationManager(ApplicationManager):
|
|||||||
|
|
||||||
return warnings
|
return warnings
|
||||||
|
|
||||||
|
def _fill_suggestions(self, suggestions: list, man: ApplicationManager, limit: int):
|
||||||
|
if self._is_enabled(man):
|
||||||
|
man_suges = man.list_suggestions(limit)
|
||||||
|
if man_suges:
|
||||||
|
suggestions.extend(man_suges)
|
||||||
|
|
||||||
def list_suggestions(self, limit: int) -> List[Application]:
|
def list_suggestions(self, limit: int) -> List[Application]:
|
||||||
if self.managers:
|
if self.managers:
|
||||||
suggestions = []
|
suggestions, threads = [], []
|
||||||
for man in self.managers:
|
for man in self.managers:
|
||||||
if self._is_enabled(man):
|
t = Thread(target=self._fill_suggestions, args=(suggestions, man, limit))
|
||||||
man_suggestions = man.list_suggestions(SUGGESTIONS_LIMIT)
|
t.start()
|
||||||
if man_suggestions:
|
threads.append(t)
|
||||||
man_suggestions = man_suggestions[0:SUGGESTIONS_LIMIT] if len(man_suggestions) > SUGGESTIONS_LIMIT else man_suggestions
|
|
||||||
suggestions.extend(man_suggestions)
|
for t in threads:
|
||||||
|
t.join()
|
||||||
|
|
||||||
return suggestions
|
return suggestions
|
||||||
|
|||||||
Reference in New Issue
Block a user