mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Downloader]: RepoManager: don't load repos in __init__ (#2829)
Loading repos is already done in initialize() method. This could actually turn out badly if both of git processes would touch the same repo at the same time. This also fixes create_backup in setup.py - now it properly generates repos.json
This commit is contained in:
parent
081bf663a4
commit
942dca43d3
@ -540,9 +540,6 @@ class RepoManager:
|
||||
def __init__(self):
|
||||
self._repos = {}
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.create_task(self._load_repos(set=True)) # str_name: Repo
|
||||
|
||||
async def initialize(self):
|
||||
await self._load_repos(set=True)
|
||||
|
||||
|
||||
@ -409,8 +409,9 @@ async def create_backup(instance):
|
||||
from redbot.cogs.downloader.repo_manager import RepoManager
|
||||
|
||||
repo_mgr = RepoManager()
|
||||
await repo_mgr.initialize()
|
||||
repo_output = []
|
||||
for _, repo in repo_mgr._repos:
|
||||
for repo in repo_mgr._repos.values():
|
||||
repo_output.append({"url": repo.url, "name": repo.name, "branch": repo.branch})
|
||||
repo_filename = pth / "cogs" / "RepoManager" / "repos.json"
|
||||
with open(str(repo_filename), "w") as f:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user