feat: daemon polls Gitea for new commits before sync_git_to_svn
This commit is contained in:
+2
-9
@@ -127,12 +127,5 @@ def fetch_from_gitea(mirror: Mirror, ref: Optional[str] = None) -> bool:
|
||||
timeout=300,
|
||||
)
|
||||
|
||||
# Check if anything changed
|
||||
out = _git("--git-dir", canonical, "rev-list", "--count",
|
||||
f"HEAD..FETCH_HEAD", timeout=30, check=False)
|
||||
if out and out.strip() != "0":
|
||||
logger.info("Fetched new commits from Gitea")
|
||||
return True
|
||||
|
||||
logger.debug("No new commits from Gitea")
|
||||
return False
|
||||
logger.debug("Fetch from Gitea complete")
|
||||
return True
|
||||
|
||||
+2
-1
@@ -13,7 +13,7 @@ from typing import Dict, List, Optional, Tuple
|
||||
|
||||
from .config import MirrorConfig
|
||||
from .mirror import Mirror
|
||||
from .gitea import push_to_gitea, GiteaError
|
||||
from .gitea import fetch_from_gitea, push_to_gitea, GiteaError
|
||||
from .git_to_svn import sync_git_to_svn
|
||||
from .svn import (
|
||||
SVNPathChange,
|
||||
@@ -485,6 +485,7 @@ def run_daemon_loop(mirrors: Dict[str, Mirror]) -> None:
|
||||
svn_count = sync_all(m)
|
||||
if svn_count:
|
||||
push_to_gitea(m)
|
||||
fetch_from_gitea(m)
|
||||
git_count = sync_git_to_svn(m)
|
||||
if svn_count or git_count:
|
||||
last_sync[mid] = now
|
||||
|
||||
Reference in New Issue
Block a user