File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from webapp .helpers import api_publisher_session , launchpad
1111from webapp .api .github import GitHub
1212from webapp .decorators import login_required
13+ from cache .cache_utility import redis_cache
1314
1415GITHUB_SNAPCRAFT_USER_TOKEN = os .getenv ("GITHUB_SNAPCRAFT_USER_TOKEN" )
1516GITHUB_WEBHOOK_HOST_URL = os .getenv ("GITHUB_WEBHOOK_HOST_URL" )
@@ -22,7 +23,11 @@ def get_snap_repo(snap_name):
2223 res = {"message" : "" , "success" : True }
2324 data = {"github_orgs" : [], "github_repository" : None , "github_user" : None }
2425
25- details = dashboard .get_snap_info (flask .session , snap_name )
26+ snap_info_key = f"snap_info:{ snap_name } "
27+ details = redis_cache .get (snap_info_key , expected_type = dict )
28+ if not details :
29+ details = dashboard .get_snap_info (flask .session , snap_name )
30+ redis_cache .set (snap_info_key , details , ttl = 3600 )
2631
2732 # API call to make users without needed permissions refresh the session
2833 # Users needs package_upload_request permission to use this feature
You can’t perform that action at this time.
0 commit comments